PHP prevents repeated submission of forms and handling of forms within the time limit

Source: Internet
Author: User
PHP prevents repeated form submission and form expiration. when submitting a form, the user may be maliciously refreshed due to the speed of the network, or the webpage may cause the same record to be inserted into the database repeatedly, this is a tough issue. We can start with the client and the server to avoid repeated submission of the same form. 1. when using client scripts to mention client scripts, JavaScript is often used in PHP to prevent repeated submission of forms and form expiration processing.
When a user submits a form, the same record may be repeatedly inserted into the database due to the speed of the network or the malicious refreshing of the webpage. this is a tricky problem. We can start with the client and the server to avoid repeated submission of the same form. 1. when using client scripts to mention client scripts, JavaScript is often used for regular input verification. In the following example, we use it to process the repeated submission of forms. please refer to the following code :? After you click the submit button, the button becomes unavailable, as shown in Figure 5-6 .? In the preceding example, the OnClick event is used to check the user's submission status. if you click the submit button, this button is immediately set to invalid. you cannot click the button to submit again .? Another method is to use JavaScript, but the OnSubmit () method is used. if a form has been submitted once, the dialog box is displayed immediately. the code is as follows:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.