Canman2005 Posted September 23, 2007 Share Posted September 23, 2007 Hi all I have a simple contact form which is POSTED to a simple email script. At the end of the email script, I have put the following print "<script>alert('Thank you, your message has been sent');</script>"; print "<script>location.replace('index.php?id=25');</script>"; exit; The problem is that once the script has run, if you click the back button, the form seems to want to POST again. Does anyone know why this happens and if I can stop it from happening Thanks Dave Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted September 23, 2007 Share Posted September 23, 2007 Best way to lock a form from double submission is once processing occurs set a session saying the form is submitted so they can't resubmit like Processer.php <?php session_start(); if($_SESSION['submitted'] == "yes"){ //Don't double submit header("location: form.php?error=double+submit"); } ?> Quote Link to comment Share on other sites More sharing options...
AV1611 Posted September 23, 2007 Share Posted September 23, 2007 You so smart Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted September 23, 2007 Share Posted September 23, 2007 I should state that if the user properly reopens the form (Say they want to submit another row) you need to reset the session to no Quote Link to comment Share on other sites More sharing options...
Canman2005 Posted September 23, 2007 Author Share Posted September 23, 2007 thank you Quote Link to comment 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.