/**
*
* @authors Benjamin
* @date 2013-11-13 10:16:59
*/
1. Common duplicate submission issues
a>Click the submit button twice.
b>Click the refresh button.
c>Use the browser back button to repeat the previous operation, resulting in repeated submission of the form.
d> Repeat form submissions using browser history.
e> Duplicate HTTP requests from the browser.
2. Methods to prevent repeated submission of forms
a> Disable the submit button. After the form is submitted, disable the current button or cancel the click event or default event of the button. This approach prevents impatient users from clicking the button multiple times. But there is a problem. If Javascript is disabled on the client, this method will be ineffective. Of course, for modern web sites, it should be rare.
b>Post/Redirect/Get mode. Performing page redirection after submission is the so-called Post-Redirect-Get (PRG) pattern. In short, when the user submits the form, you perform a client-side redirection and go to the submission success information page. This can avoid repeated submissions caused by the user pressing F5, and there will be no warning about repeated submissions of the browser form. It can also eliminate the same problems caused by pressing the forward and backward buttons of the browser.
c> Use cookies to handle repeated form submissions
Implementation in PHP: