Jump to content

Stopping forms re-sending information


Canman2005

Recommended Posts

Hi all

 

Just a general question really, but I have quite a few forms on a php website I have built, many of the forms used do a POST to send the data, and then my php scripts deal with the posted data from the forms.

 

Often if I have submitted a form and the PHP has done its magic, when I go back through the page history by clicking the back or forward buttons, I tend to get the messge from Firefox

 

"To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier."

 

and if "OK" is clicked, the form is submitted again, the data posted and the php scripts therefore run again.

 

This can be annoying as sometimes the form is posting data and the php is updating data or even deleting records.

 

What is the best way to overcome this and only allow the form to be posted when the submit button is clicked.

 

I have looked around online in the past, but never managed to find any good solutions.

 

Thanks

 

Dave

Link to comment
https://forums.phpfreaks.com/topic/180365-stopping-forms-re-sending-information/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.