Forum Moderators: coopster
header(Location: http://www.example.com/script.php); to return the visitor back to the form page. So far so good, I can handle that without any problem. The issue I'm having is that I want the form to be sticky - fields with correct data maintain the values the user put in them. Obviously, to get those values, I need access to the $_POST array. However, this seems to be destroyed when the
header(Location) section forwards the visitor back to the form. Is there any way to use the header Location stuff to redirect the visitor to another page, while still preserving the $_POST data?
The only way I know of to POST is to set the headers and open the file:
$header .= "POST /path-to/the-file HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($yourvariables) . "\r\n\r\n";
$fp = fsockopen ('www.example.com', 80, $errno, $errstr, 30);
There is quite a bit more information on the fsockopen manual [us3.php.net] page.
Justin
BTW Unless it is explicitly stated on a form/webpage, posting (or sending any information) to a remote server/site is considered bad practice and a security risk for users.