简体   繁体   中英

php page redirect after operation

I have a page (index.php) which has a php grid with subpages(<<1,2,3,4>>). An operation on any page takes you back to index.php. Using $_GET['prd_p'] or $_REQUEST['prd_p'] gives you the page number. 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)

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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