Canman2005 Posted November 5, 2009 Share Posted November 5, 2009 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 More sharing options...
xtopolis Posted November 5, 2009 Share Posted November 5, 2009 Personally, I make my forms redirect back to themselves after processing. header Link to comment https://forums.phpfreaks.com/topic/180365-stopping-forms-re-sending-information/#findComment-951514 Share on other sites More sharing options...
prasanthmj Posted November 5, 2009 Share Posted November 5, 2009 After processing the form, redirect to a response page : header("Location: thankyou.html"); See the page below for an example: PHP form tutorial Link to comment https://forums.phpfreaks.com/topic/180365-stopping-forms-re-sending-information/#findComment-951516 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.