This is a problem I've encountered a few times and never got to the bottom of it.
I have a form that submits twice, even though I only click on it once.
On Page 1, I have an image for a submit button
<input class=submit_button type="image" src="imginside/submit_button.gif" width="84" height="20" border="0" alt="Submit Student Names" onClick="return SubmitUnits();">
That calls on a javascript validation function as such
function checkform()
{
if (enroll_form.enroll_number.value > 100)
{
alert("This number is too big. Max: 100 per booking");
enroll_form.enroll_number.focus();
return (false);
}
// ** If Everything is OK then submit **
enroll_form.submit();
return true ;
}
WHen a good entry is entered, it goes to the next page, which has some PHP code in it, which is run twice instead of once.
It creates the same information in the DB with the same date & time exactly.
Anyone got any ideas as to why this happens, and how to avoid it.
Is it something to do with the image button as a submit button
Thanks,
A.