【发布时间】:2014-12-17 10:24:22
【问题描述】:
我试图从我创建的另一个页面中的文本框中获取值,并且文本框自动设置为 0,但它一直告诉我索引未定义?但是一旦您单击确认按钮,值就会被提交,但我希望它自动设置为 0 而无需单击按钮。
这是第 1 页:
<?php
if(isset($_POST['topscart']))
{
$_SESSION['topscart']=$_POST['topscart'];
print"<script language=javascript>
window.location='ACCOUNT.php';
</script>";
}
?>
这是第 2 页:
<td>No. of Female Tops Ordered: </td>
<td><center><?php
print" ".$_SESSION['topscart'];
?>
</td>
第 1 页的文本框代码:
No. of Female Tops in Your Cart: <input type="text" value="0" size="10" name="topscart" id="topscart" >
Total: <input text="text" size="10" value="0" name="topstotal" id="topstotal" >
<input type ="submit" value="Confirm Order"></button>
<input type ="reset" id="topsbutton2" name="topsbutton2" value="Cancel Order"></button>
</center>
【问题讨论】:
-
在第 2 页你有 session_start(); 吗?在第 1 页你有 session_start(); 吗?
-
是的,我在顶部都有这两个。
-
您可能有其他导致麻烦的代码。就像会话销毁或会话取消设置
-
“文本框”是指“复选框”吗?
-
请提供有关表单以及如何发送数据的更多信息