shibbi3 Posted October 11, 2006 Share Posted October 11, 2006 hi everyone,I was just wondering if anyone knows how to do the following:Right now I have a form setup and when the user submits it, I want a new page to come up that says 'FORM SUBMITTED THANK YOU', and then after a 5 second delay it auto redirects the user back to the main page say 'index.php'...Im not sure if this is a php problem... does anyone know?My form is the following:[code]<form method="post" action="<?php echo basename($_SERVER["PHP_SELF"]); ?>" enctype="application/x-www-form-urlencoded"><div> <p><b>Name:</b><br /><input type="text" name="name" value="<?php if (isset($name)) echo htmlentities(stripslashes($name)); else echo ""; ?>" size="35" /></p> <p><b>E-mail:</b><br /><input type="text" name="email" value="<?php if (isset($email)) echo htmlentities(stripslashes($email)); else echo ""; ?>" size="35" /></p> <p><b>Subject:</b><br /><input type="text" name="subject" value="<?php if (isset($subject)) echo htmlentities(stripslashes($subject)); else echo ""; ?>" size="35" /></p> <p><b>Message:</b><br /><textarea name="text" cols="55" rows="12"><?php if (isset($text)) echo htmlentities(stripslashes($text)); else echo ""; ?></textarea></p> <br /><br /> <p><input type="submit" name="form_submitted" value="OK - Submit" /></p> </div></form>[/code]Everything is working except I want a new page to come up when its submitted and After a 5 second stop on the new page, I want to redirect the user to the main page.Thanks for any suggestions! Quote Link to comment https://forums.phpfreaks.com/topic/23703-question-regarding-delay/ Share on other sites More sharing options...
roopurt18 Posted October 11, 2006 Share Posted October 11, 2006 AFAIK you can't redirect with a delay in PHP; you'd need to use javascript or (not sure about this) a meta tag. Quote Link to comment https://forums.phpfreaks.com/topic/23703-question-regarding-delay/#findComment-107596 Share on other sites More sharing options...
alpine Posted October 12, 2006 Share Posted October 12, 2006 [code]<?phpif(isset($_POST['form_submitted'])){// blah blahecho <<<_HTML<meta http-equiv="refresh" content="5; url=index.php" /> // send to index.php in 5 seconds_HTML;}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/23703-question-regarding-delay/#findComment-107755 Share on other sites More sharing options...
wildteen88 Posted October 12, 2006 Share Posted October 12, 2006 You can redirect with a delay with PHP. Use a header refresh:[code=php:0]header("Refresh: 5; URL=http://www.google.com");[/code] Quote Link to comment https://forums.phpfreaks.com/topic/23703-question-regarding-delay/#findComment-107914 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.