【发布时间】:2014-06-03 22:41:14
【问题描述】:
我有一个 html 表单(method = "get", action = "cart.php"),我在其中使用两个按钮发送相同的表单。
echo '<input type="image" src="data/images/back.png" height="40px" id="back" name="back">';
echo '<input type="image" src="data/images/continue.png" height="40px" id="go" name="go">';
现在,在 PHP 端,我想检查单击了哪个按钮(“开始”按钮或“返回”按钮)。
我已经完成了:
if(isset($_GET['go.x']) == true)
{
echo 'form submitted using button GO';
}
else
{
echo 'form submitted using button BACK';
}
我使用“go.x”变量名,因为表单传递“go.x”和“go.y”变量(用户单击的图像按钮内的确切 x、y 位置)
然而,isset() 函数总是返回 false……怎么可能呢? 谢谢
【问题讨论】:
-
当你
print_r($_GET);时会发生什么? -
x 和 y 是单独的 GET 值,只需使用 'go'。
-
天哪...我自己解决了...我做了 isset($_GET[back_x] == true) 并且它工作了
-
@Chirs:这行不通。已经试过了。不过我解决了
标签: javascript php html forms web