Essentially, I have a form inside a php file, and I want to disable the submit button when the user clicks the submit button. If not, my database becomes spam after a few clicks.
I searched for stackoverflow and googled my problem and tried many solutions not working. Not sure if I'm stupid or what. After numerous trial and error, I still can’t get the form to submit, so I made a new thread. I tried to set the "onsubmit" property on the form submit input, but the form does not submit at all, it just got stuck. Also tried other Javascript solutions without success.
Any help would be greatly appreciated! Please do not be harsh, I have little or no experience in Javascript.
<form action="adduser.php" method="POST">
<div class="form_attr">
<label>Username:</label><input type="text" name="username" value="<?php if ($err_flag == true){echo htmlspecialchars($username);}?>">
<br/>
<label>Password:</label><input type="password" name="password" value="">
<br/>
<label>Firstname:</label><input type="text" name="firstname" value="<?php if ($err_flag == true){echo htmlspecialchars($firstname);}?>">
<br/>
<input type="checkbox" name="admin" value="1"> Admin<br/>
<input type="checkbox" name="receptionist" value="2"> Receptionist<br/>
<input type="checkbox" name="technician" value="4"> Technician<br/>
<input type="submit" name="submit" value="submit">
</div>
</form>