Hi all the PHP heads,
I know its basic but this is doing my head in a bit.
Any help please!
****************************************************
___________
HTML STUFF
___________
Code:
<?php
if ($submit){
if (!$email || BLAH || !$eCheck)
{
$error = "Required Fields Missing (*)!";
$error1 = "(*)";
}
else {
echo "<fieldset><legend>Application Recieved</legend><div align=\"center\"><span class=\"thanx\"><br />Thank you for
your application.<br />We will contact you shortly.<br /><br /></span></div></fieldset><br />";
}
}
if (!$submit || $error) {
echo "<div align=\"center\"><span class=\"red\">$error</span></div>";
?>
____
Form stuff
____
//////////////////////////////////////////////////////////////////////
// Problem lies below somewhere I guess!
// On submit if email is varified
// It doesn't assign the $eCheck variable, until next submit
// Hence you have to enter submit twice
// I am stumped! And been at it for far too long- Any ideas!
// All I wanted to do was validate the form, check the email and submit the page
//////////////////////////////////////////////////////////////////////
Code:
<?php
if ($email!="" && (!eregi("^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}", $email))) { echo
"Invalid E-Mail address!";
}
if ($email!="" && (eregi("^[a-z0-9]+([-_\.]?[a-z0-9])+@[a-z0-9]+([-_\.]?[a-z0-9])+\.[a-z]{2,4}", $email))) {
$eCheck = "correct";
}
?>
</span>
</span>
</div>
</fieldset>
<input name="eCheck" type="hidden" id="eCheck" value="
Code:
<?php echo $eCheck ?>
" />
___________________
REST OF FORM STUFF
___________________
REST IF THE HTML
___________________
Any help greatly appreciated, cheers
V