Is there a way to do the above? Basically, I don\'t want the form to be submitted again if someone presses refresh after already submitting the form once. In which case the
The problem you are facing above specifically can (and should) be solved with Post/Redirect/Get. Unsetting _POST
on the php side would be ineffective since the problem is it is a separate request.
You also have to deal with double-clicking of submission buttons. You can solve this on the client side by disabling form submission after the button click, or by putting a random token in the form and storing that token in the session. The token will be accepted only once (session keeps track of whether the token has been posted).