njdubois Posted November 29, 2012 Share Posted November 29, 2012 I have a form, with a text box and a submit button. When they click submit it saves to a database. Say the submits name/id is save_button. I use if(isset($_POST['save_button'])) { // do save to database stuff here. } The user clicks save, it saves the database, then for whatever reason hits the Refresh Button. Adding a double to the database. I don't understand how to stop this from happening? Any recommendations? Thanks Nick Quote Link to comment https://forums.phpfreaks.com/topic/271374-refresh-on-browser-after-clicking-a-save-button/ Share on other sites More sharing options...
Christian F. Posted December 2, 2012 Share Posted December 2, 2012 Add a HTTP redirect after saving the posted data in the database, and kill the script immediately after. This will prevent the F5-resend problem. Also, are you using JS/AJAX to submit the form, by any chance? Quote Link to comment https://forums.phpfreaks.com/topic/271374-refresh-on-browser-after-clicking-a-save-button/#findComment-1396772 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.