简体   繁体   English

操作后的php页面重定向

[英]php page redirect after operation

I have a page (index.php) which has a php grid with subpages(<<1,2,3,4>>). 我有一个页面(index.php),其中有一个带有子页面(<< 1,2,3,4 >>)的php网格。 An operation on any page takes you back to index.php. 在任何页面上的操作都将带您回到index.php。 Using $_GET['prd_p'] or $_REQUEST['prd_p'] gives you the page number. 使用$ _GET ['prd_p']或$ _REQUEST ['prd_p']可提供页码。 I want users to stay on a page after an operation, that means i have to use redirects. 我希望用户在操作后留在页面上,这意味着我必须使用重定向。

<form name="frmSearchMe" action="<?php echo $page_name; ?>" method="POST">
<tr>
 <input class='form_button' type='submit' name='btnSubmit' value=' Save ' onclick='return checkerrors();' /></td>
 </tr>
//php codes here
</form>

The location header can be used to redirect people 位置标头可用于重定向人员

header('Location: index.php?stuff=squirrel');

If you're going to be setting values in there based on user data, make sure you validate them first (with a function like ctype_digit for example) 如果要根据用户数据在其中设置值,请确保首先验证它们(例如使用ctype_digit之类的功能)

Yes, You have to redirect back to the same page after performing the operation. 是的,执行该操作后,您必须重定向回同一页面。

header("location:url&".$_GET['prd_p']);
die();

You should use die() or exit() after the redirect statment. 您应该在重定向语句之后使用die()exit()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM