52 mins ago: Remove cover plate on patio door?

Mend Application Development

Mend Software, Application Development
Find out how to mend it for free.

Ask Question
Mend Software, Application Development
Mend repair fix application development

Mend > Application Development

Mend Software, Application Development

How can I stop a php form from being processed twice?

I am writing a web site and using PHP and MySQL database. I have developed a form. When this is submitted the browser is pointed to another php page which processes the input and thanks the visitor. I have found a problem. If the visitor refreshes the browser the data will be processed again. How can I ensure that the processing page cannot be run again when the user refreshes their browser?

Ray Wilks
March 2004
David if the user hits their Back Button the form will submit again. How would you stop this happening?

Jon
February 2005
If you have ever used a PHP-based discussion board then you would see how they deal with it, they create an intermediate page which does the saving and then redirect the user from their to the next page.

The intermediate page will usually say something like "Thanks for logging on, you are now being redirected back to the forum".

Of course, if they refreshed on this page then it would do the same double-post, but it is unlikely they will refresh during the second or two that redirection is taking place :)

David Carrington
May 2004
Mend Software, Application Development
Mend repair fix application development

How to mend ...

Find out how to mend just about anything howtomendit.com for free repair help, information and advice.
Mend Software, Application Development
Mend repair fix application development