Log in

View Full Version : Open a new webpage



Burgin
06-08-2011, 10:10 AM
I'm using a PHP file to activate an email form and understand very little of PHP but the end of the file is below.

After they prove they are human the thank you image opens but if they fail it opens the failed image, inviting them to try again. That bit works great.

Is it possible for the section that opens the thank you image to then go to a new webpage after say 10 seconds?

Here's the end of the code I'm using...


|---------END MESSAGE----------|';

mail($to, $subject, $body);


echo "<style type='text/css'>body{width:450px; height:390px; margin:0px; padding:0px;}</style><div style='width:width:450px; height:390px; margin:0px; padding:0px; background:url(../../assets/images/bkgs/form-thanx-find.png); filter:alpha(opacity=100);'></div>"; /* YOUR CODE GOES HERE */
unset($_SESSION[captcha]); /* this line makes session free, we recommend you to keep it */
}
elseif($_SERVER['REQUEST_METHOD'] == "POST" && !$_POST[captcha])
{
echo "<style type='text/css'>body{width:450px; height:390px; margin:0px; padding:0px;}</style><div style='width:450px; height:390px; margin:0px; padding:0px; background:url(../../assets/images/bkgs/form-fail-find.png); filter:alpha(opacity=100);'></div>";
}
/* in case that form isn't submitted this file will create a random number and save it in session */
else
{
$rand = rand(0,4);
$_SESSION[captcha] = $rand;
echo $rand;
}
?>

xtiano77
06-15-2011, 07:27 PM
I think you would be better served by using JavaScript to accomplish the redirection. Checkout the link below:

http://www.w3schools.com/js/js_timing.asp