Jump to content

Preventing Form-Resubmmission on Page-Refresh


mostafatalebi

Recommended Posts

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.

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.