My form currently checks two email fields to make sure they match. I would also like it to make sure neither of the two email fields are empty AND a checkbox has been checked off. I've been scouring for examples and nothing seems to do the trick.
Any help would be greatly appreciated.
<form action="" method="post" name="submission" onsubmit="return checkEmail(this);">
<label for="email">Email</label>
<input id="email" maxlength="55" name="email" type="text" value="<?=htmlspecialchars($_POST["email"]) ?>" /><br/>
<label for="emailconfirm">Confirm email address</label>
<input id="emailconfirm" maxlength="55" name="emailconfirm" type="text" value="<?=htmlspecialchars($_POST["emailconfirm"]) ?>" /><br/>
<label for="checksign">By completing this form, you agree to the terms and conditions above. If you do not agree to these terms, your application will not be considered.</label>
<input class="check" id="checksign" name="checksign[]" type="checkbox" value="Yes" />
</form>
<script type="text/javascript" language="JavaScript">
function checkEmail(theForm) {
if (theForm.email.value != theForm.emailconfirm.value)
{
alert('E-mail addresses do not match.');
return false;
} else {
return true;
}
}
</script>