这是我的代码。
if(isset($_POST['add']))
{
$_POST['os_number'];
$_POST['product'];
$_POST['quantity'];
header('location:index.php?page=pos');
}
此代码属于pos.php
并链接(pos/index.php?page=pos)
但是当我点击提交按钮时,它会使用此链接(pos/index.php?os_number=1001&product=1&quantity=&add=ADD)
重定向到 index.php 我想知道为什么。我需要你的帮助。它应保留在pos/index.php?page=pos
链接中。
答案 0 :(得分:2)
如果您要将表单发布到index.php
,可以删除代码并在html上使用此代码。这会在您点击提交时将您重定向到index.php?page=pos
<form action="index.php?page=pos" method="post">
<input type = "text" name = "os_number"/>
<input type = "text" name = "product"/>
<input type = "text" name = "quantity"/>
<input type = "submit" name = "add" value = "ADD" />
</form>
更好的是,您可以将page=pos
放在隐藏的输入
<input type = "hidden" name = "page" value = "pos"/>
希望这个帮助
答案 1 :(得分:0)
在exit
行之后使用header('location:index.php?page=pos');
。