Home >Web Front-end >JS Tutorial >JavaScript avoids multiple submissions and saves of forms
Friends who have used forms to submit data and save it should have encountered multiple submission forms that refresh once and submit once. This article introduces a method to avoid the form being submitted and saved multiple times.
1. javascript, set up a Variables are only allowed to be submitted once.
2. javascript, will Set the submit button or image to disable
onsubmit="getElById('submitInput')
.disabled = true;
return true;
"> ;
src="images/ok_b.gif"
border="0" />
After using the above method, You will find that after you submit the form, you will refresh it multiple times. There is only one entry in the database and it will not be saved multiple times.
The above is the content of javascript to avoid multiple submissions and saves of the form. For more related articles, please pay attention to the PHP Chinese website (www.php.cn)!