mostafatalebi Posted January 10, 2013 Share Posted January 10, 2013 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? Link to comment https://forums.phpfreaks.com/topic/272950-preventing-form-resubmmission-on-page-refresh/ 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 Link to comment https://forums.phpfreaks.com/topic/272950-preventing-form-resubmmission-on-page-refresh/#findComment-1404699 Share on other sites More sharing options...
mostafatalebi Posted January 10, 2013 Author Share Posted January 10, 2013 thanks Link to comment https://forums.phpfreaks.com/topic/272950-preventing-form-resubmmission-on-page-refresh/#findComment-1404707 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. Link to comment https://forums.phpfreaks.com/topic/272950-preventing-form-resubmmission-on-page-refresh/#findComment-1404713 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.