note 95321 added to function.header
| From: | tomikaze at osu1 dot php dot net | Date: | Sun, 27 Dec 2009 12:29:51 +0000 |
| Subject: | note 95321 added to function.header | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-164347@lists.php.net to get a copy of this message | ||
Someone may soon come to that POST data is not sent along implicitly when making a redirect by a
Location header. This can be annoying when (double) validating a form in a separate script and
redirecting back to the page containing the form if validation fails.
Though there is some woodoo for sending POST data explicitly from php, one simpler and maybe more
elegant workaround is registering POST data as session variables.
<?php
session_start();
$_SESSION = array_merge($_SESSION, $_POST);
header("Location: myform.php");
?>
Also do not forget to call session_start() at the beginning of myform.php.
----
Server IP: 92.43.200.200
Probable Submitter: 77.111.79.115
----
Manual Page -- http://www.php.net/manual/en/function.header.php
Edit -- https://master.php.net/note/edit/95321
Del: integrated -- https://master.php.net/note/delete/95321/integrated
Del: useless -- https://master.php.net/note/delete/95321/useless
Del: bad code -- https://master.php.net/note/delete/95321/bad+code
Del: spam -- https://master.php.net/note/delete/95321/spam
Del: non-english -- https://master.php.net/note/delete/95321/non-english
Del: in docs -- https://master.php.net/note/delete/95321/in+docs
Del: other reasons-- https://master.php.net/note/delete/95321
Reject -- https://master.php.net/note/reject/95321
Search -- https://master.php.net/manage/user-notes.php