mostafatalebi Posted January 10, 2013 Share Posted January 10, 2013 (edited) Hello everybody I have set my form's action to none so that I use inline code to process the form's submission. However I need to prevent the page from resubmitting the form when the user refreshes the page. How could I achieve this? Edited January 10, 2013 by mostafatalebi Quote Link to comment Share on other sites More sharing options...
Ninjakreborn Posted January 10, 2013 Share Posted January 10, 2013 http://bjw.co.nz/developer/general/75-how-to-prevent-form-resubmission Quote Link to comment Share on other sites More sharing options...
mostafatalebi Posted January 10, 2013 Author Share Posted January 10, 2013 thanks Quote Link to comment Share on other sites More sharing options...
Christian F. Posted January 10, 2013 Share Posted January 10, 2013 That's not how I'd do it, as that doesn't completely prevent re-submission of the form. A coupel of those methods just prevents the server-side handling of the submitted data, if that, and the JS method won't work against people who've disabled JS (or bots). The best way to do this, is by using a HTTP redirect with the header() function. That way you remove the POST request from the browser's history, and any subsequent visits (via F5 or history) will only trigger a GET request. PS: Remember to use die () after the redirect, to stop the script for parsing the code below. 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.