Re: IE/ IIS / PHP - Form posted twice in case of redirection

From: Date: Wed, 25 Jun 2008 19:39:43 +0000
Subject: Re: IE/ IIS / PHP - Form posted twice in case of redirection
Groups: php.windows 
Request: Send a blank email to php-windows+get-28975@lists.php.net to get a copy of this message
Even this didn't work. It seems IE just posts twice the same form on its own and redirect is blank both times. Is there any utility to debug what database is being passed around like avaiable in firefox Sukhwinder Singh
----- Original Message ----- From: "Dan Shirah" <mrsquash2@gmail.com> To: "Sukhwinder Singh" <ssruprai@hotmail.com> Cc: <php-windows@lists.php.net> Sent: Wednesday, June 25, 2008 6:11 PM Subject: Re: [PHP-WIN] IE/ IIS / PHP - Form posted twice in case of redirection
Sukhwinder,
I would suggest trying something simple like adding a variable to see if your page posted. Then, if it has run a simple Javascript function to redirect your page. <head> <script language="JavaScript"> <!-- function redirect() { location.replace(http://URL); } //--> </script> </head> <?php $redirect = $_POST['redirect']; if ($redirect == "Y") { ?> <body onload="redirect()"> <?php } else { ?> <body> <?php } ?> <form name="MyForm" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <input type="hidden" name="redirect" value="Y"> <ALL YOUR OTHER FORM DATA HERE> <input type="submit" name="Submit" value="Submit"> </body> So, by default the value of $redirect will be "". Once you put data into your form and submit it, the value of $redirect will be "Y" in which case the Javascript function will be called and send you to your other page. Hopefully that helps. Dan


« previous php.windows (#28975) next »