怎么把一个文本输入框里输入的值保留下来,并传值 echo "<td><input type='text' name='txt_num".$value1[0]."']' value='". $value1[3]."'/></td>";我想把这个文本框里输入的值进行传值。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <html><head> <meta http-equiv="Content-Type" content="text/html; charsetgb2312" /> <title>购物车</title> <link href="images/style.css" rel="Stylesheet" type="text/css" /> </head><body style="margin:0px 0px 0px 0px; text-align:center"><table border="1" cellspacing="0" cellpadding="0" style="width:100%"><tr><td valign="top" width="750px"> <table border="1" cellspacing="0" cellpadding="0" style="width:100%"><tr bgcolor="#D6D6D6"><td height="54" colspan="7" align="Center">我的购物车</tr><tr><td width="24%" bgcolor="#D6D6D6">商品编号</td><td width="24%" bgcolor="#D6D6D6">商品名称</td><td width="13%" bgcolor="#D6D6D6">图片</td><td width="10%" bgcolor="#D6D6D6">数量</td><td width="12%" bgcolor="#D6D6D6">价格</td><td width="17%" colspan="2" bgcolor="#D6D6D6">操作</td></tr><?php//session_id(SID);@session_start(); require_once("conn/Conn_DB.php"); //包含数据库链接文件 if($_GET["P_ID"]!="") { $pid = $_GET["P_ID"]; //商品编号 $str = "select * from Product_Info where P_ID =".$pid; $arr = mysql_query( $str); //执行SQL语句 $result = mysql_fetch_array($arr); //获取查询结果 //$num = $_POST["number"]; $a = array($result["P_ID"],$result["P_Name"],$result["P_Image"],'1',$result["P_VPrice"]); if($_SESSION['car'] == "") //创建购物车SESSION变量 $car_arr=array(); else $car_arr = (array)$_SESSION['car']; array_push($car_arr,$a); $_SESSION['car'] = $car_arr; }?><?php //session_id(SID);@session_start(); if($_SESSION['car']!= "") //显示购物车SESSION信息 { $arr2 = (array)$_SESSION['car']; foreach ($arr2 as $key1=> $value1 ) { echo "<tr>"; echo "<td>". $value1[0]."</td>"; echo "<td>". $value1[1]."</td>"; echo "<td><img src='". $value1[2]."' width='39' height='39'/></td>"; echo "<td><input type='text' name='txt_num".$value1[0]."']' value='". $value1[3]."'/></td>"; echo "<td>". $value1[4]."</td>"; echo "<td><a class='a1' href='action/shopcar_do.php?type=2'>更新数量</a></td>"; //echo "<td><a class='a1' href='action/shopcar_do.php?type=3'>删除</a></td>"; echo"</tr>"; } ?> <tr bgcolor="#D6D6D6"><td colspan="7"><a class="a1" href="action/shopcar_do.php?type=1">清空购物车</a> <a class="a1" href="index_content.php">继续购物</a> <a class="a1" href="member_order_add.php">提交订单</a></td></tr> <?php } else { echo "<tr><td colspan='7' align='center'>当前购物车为空!</td></tr>"; }?></table></td></tr></table></body></html> 传到另外一个php文件,我的想法的是用session传值,但是输入的值传不到session 在外面套一个form 表单,action="member_order_add.php",再加一个提交按钮。 如何读取同一类COOKIE mysql_query() 能执行所有sql语句么? 在线咨询程序用什么语言开发 很怪的错误??????? 怎样得知服务器装了gd2库没有? 只会做WEB程式, 但想问问什么是PHP开发 :P jsp和php哪种语言好???再集大家意见与一体[我目前依然在搞php] 怎么选网页游戏的服务器 如何点击按钮执行php函数 PHP分页问题 用ereg判断字符串是否包含星号怎么表示 有谁做过网络广告机的后台内容管理系统(php),和普通的php应用程序有啥区别?
<head>
<meta http-equiv="Content-Type" content="text/html; charsetgb2312" />
<title>购物车</title>
<link href="images/style.css" rel="Stylesheet" type="text/css" />
</head>
<body style="margin:0px 0px 0px 0px; text-align:center">
<table border="1" cellspacing="0" cellpadding="0" style="width:100%">
<tr>
<td valign="top" width="750px">
<table border="1" cellspacing="0" cellpadding="0" style="width:100%">
<tr bgcolor="#D6D6D6"><td height="54" colspan="7" align="Center">我的购物车</tr>
<tr><td width="24%" bgcolor="#D6D6D6">商品编号</td><td width="24%" bgcolor="#D6D6D6">商品名称</td><td width="13%" bgcolor="#D6D6D6">图片</td><td width="10%" bgcolor="#D6D6D6">数量</td><td width="12%" bgcolor="#D6D6D6">价格</td><td width="17%" colspan="2" bgcolor="#D6D6D6">操作</td></tr>
<?php
//session_id(SID);
@session_start();
require_once("conn/Conn_DB.php"); //包含数据库链接文件
if($_GET["P_ID"]!="")
{
$pid = $_GET["P_ID"]; //商品编号
$str = "select * from Product_Info where P_ID =".$pid;
$arr = mysql_query( $str); //执行SQL语句
$result = mysql_fetch_array($arr); //获取查询结果
//$num = $_POST["number"];
$a = array($result["P_ID"],$result["P_Name"],$result["P_Image"],'1',$result["P_VPrice"]);
if($_SESSION['car'] == "") //创建购物车SESSION变量
$car_arr=array();
else
$car_arr = (array)$_SESSION['car'];
array_push($car_arr,$a);
$_SESSION['car'] = $car_arr;
}
?>
<?php
//session_id(SID);
@session_start(); if($_SESSION['car']!= "") //显示购物车SESSION信息
{
$arr2 = (array)$_SESSION['car'];
foreach ($arr2 as $key1=> $value1 )
{
echo "<tr>";
echo "<td>". $value1[0]."</td>";
echo "<td>". $value1[1]."</td>";
echo "<td><img src='". $value1[2]."' width='39' height='39'/></td>"; echo "<td><input type='text' name='txt_num".$value1[0]."']' value='". $value1[3]."'/></td>";
echo "<td>". $value1[4]."</td>";
echo "<td><a class='a1' href='action/shopcar_do.php?type=2'>更新数量</a></td>";
//echo "<td><a class='a1' href='action/shopcar_do.php?type=3'>删除</a></td>";
echo"</tr>";
}
?>
<tr bgcolor="#D6D6D6"><td colspan="7"><a class="a1" href="action/shopcar_do.php?type=1">清空购物车</a>
<a class="a1" href="index_content.php">继续购物</a>
<a class="a1" href="member_order_add.php">提交订单</a>
</td></tr>
<?php
}
else
{
echo "<tr><td colspan='7' align='center'>当前购物车为空!</td></tr>";
}
?>
</table>
</td></tr></table>
</body>
</html>