I want to prevent multiple form submission on multiple clicks.
I actually want to insert data into the DB. The process takes a little time, like 2-3 second.
The problem is, that within the 2-3 second the visitor can click about 6-7 times to that button, and it will run the script over and over again.
How can i prevent it?
I tried this code:
<!DOCTYPE html>
<head>
<title>My Form</title>
</head>
<body>
<form action="process.php" method="post">
<input type="hidden" name="form_token" value="<?php echo $form_token; ?>" />
<div>
<label for="name">Name</label>
<input type="text" name="name" />
<div>
<div>
<input type="submit" value="Add Name" onclick="this.disabled=true;return true;" />
</div>
</form>
</body>
</html>