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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>
> 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

[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux