[英]click submit button redirect to index.php
here's my code. 这是我的代码。
if(isset($_POST['add']))
{
$_POST['os_number'];
$_POST['product'];
$_POST['quantity'];
header('location:index.php?page=pos');
}
this code belongs to pos.php
and link (pos/index.php?page=pos)
but when I click the submit button it redirects to index.php with this link (pos/index.php?os_number=1001&product=1&quantity=&add=ADD)
I wonder why. 此代码属于pos.php
和链接(pos/index.php?page=pos)
但是当我单击“提交”按钮时,它将使用此链接重定向到index.php (pos/index.php?os_number=1001&product=1&quantity=&add=ADD)
我不知道为什么。 I need your help guys. 我需要你们的帮助。 it should remain in pos/index.php?page=pos
link. 它应该保留在pos/index.php?page=pos
链接中。
If you want to post your forms to index.php
you can erase your code and use this on your html. 如果要将表单发布到index.php
,则可以删除代码,并在html上使用它。 This will redirect you to index.php?page=pos
when click submit 单击提交时,这会将您重定向到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>
and better you can just put page=pos
on a hidden input 更好的是,您可以将page=pos
放在隐藏的输入中
<input type = "hidden" name = "page" value = "pos"/>
Hope this help 希望这个帮助
Use exit
after header('location:index.php?page=pos');
在header('location:index.php?page=pos');
之后使用exit
header('location:index.php?page=pos');
line. 线。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.