|
Prev: Problem with Oracle and some other extensions on IIS Server
Next: php-config script is missing from the installer
From: "Dan Shirah" on 25 Jun 2008 08:41 > > 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
From: "Sukhwinder Singh" on 25 Jun 2008 09:31 Hello Dan, Thank you very much for your suggestion. There are workarounds but I am trying to find out why it is happening. I think not many use IIS and PHP for development or hosting and I was trying to find if anyone else too faced this problem and could find out why it was happening. Sukhwinder Singh ----- Original Message ----- From: "Dan Shirah" <mrsquash2(a)gmail.com> To: "Sukhwinder Singh" <ssruprai(a)hotmail.com> Cc: <php-windows(a)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 >
From: "Sukhwinder Singh" on 25 Jun 2008 15:39 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(a)gmail.com> > To: "Sukhwinder Singh" <ssruprai(a)hotmail.com> > Cc: <php-windows(a)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 >> >
From: "Dan Shirah" on 25 Jun 2008 16:01 Are you sure it's not something in your code? I am also using IE/IIS/PHP and I have a form that on submission closes the page and opens up a new window displaying "Your data has been saved" and it does not create 2 rows in my MSSQL database. Dan
From: "Sukhwinder Singh" on 25 Jun 2008 16:10
If it was something in the code then then it would happen for ever browser / server combination. not just IE/IIS/PHP. This is what making me mad. I have been doing this php stuff for more than 5 years now. Still trying to figure if it is really something in code which makes IE unhappy. Sukhwinder Singh ----- Original Message ----- From: Dan Shirah To: Sukhwinder Singh Cc: php-windows(a)lists.php.net Sent: Thursday, June 26, 2008 1:31 AM Subject: Re: [PHP-WIN] IE/ IIS / PHP - Form posted twice in case of redirection Are you sure it's not something in your code? I am also using IE/IIS/PHP and I have a form that on submission closes the page and opens up a new window displaying "Your data has been saved" and it does not create 2 rows in my MSSQL database. Dan |