【发布时间】:2017-12-30 05:20:16
【问题描述】:
提交表单后,作为 post id 的 $_GET 值消失了。 我如何在提交后放置这个事件......也包含表单的所有值......
【问题讨论】:
-
在此处发布您的代码。
-
发布您的表单代码
提交表单后,作为 post id 的 $_GET 值消失了。 我如何在提交后放置这个事件......也包含表单的所有值......
【问题讨论】:
您可以使用hidden fields 通过form submit 发送附加值。像这样:
<form action="myOtherFile.php" method="GET">
<!-- put it anywhere inside the form and give it a desired name and value -->
<input type="hidden" name="postId" value="PutValueHere" />
<!-- and the rest of the form -->
<input type="text" name="address" value="" />
<!-- and so on ... -->
<input type="submit" value="Submit me" />
</form>
在接收的 PHP 文件中,你会得到这样的变量:
if(isset($_GET['postId']))
{
echo "ID is: ".$_GET['postId'];
}
【讨论】: