marnimatul
May 5th, 2006, 22:41
if (empty($name) || empty($email) || empty($subject) || empty($msg))
{
echo " <center><p><h3>Sorry, you missed some required fields. Please go back and re-enter your information.</h3></p></center>";
}
elseif(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {
print " <center><p><h3>Sorry the email address you entered looks like it's invalid.</h3></p></center>";
}
else
{
mail($to, $sub, $mes, $headers);
print " <center><p><h1><center>Thank you, ".$name.", for registering for JBN Media Access.<br>
</center></h1></p></center><br>";
}
?>
I don't really know what I am doing. I got this php code for forms and changed it for myself. My problem is that when the form validates I want to offer a link to another page only in the final 'else' statement in the code above. I just can't seem to do it right. I can put it after the php close tag but then the link shows up even when the form doesn't validate. Please help!
{
echo " <center><p><h3>Sorry, you missed some required fields. Please go back and re-enter your information.</h3></p></center>";
}
elseif(!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) {
print " <center><p><h3>Sorry the email address you entered looks like it's invalid.</h3></p></center>";
}
else
{
mail($to, $sub, $mes, $headers);
print " <center><p><h1><center>Thank you, ".$name.", for registering for JBN Media Access.<br>
</center></h1></p></center><br>";
}
?>
I don't really know what I am doing. I got this php code for forms and changed it for myself. My problem is that when the form validates I want to offer a link to another page only in the final 'else' statement in the code above. I just can't seem to do it right. I can put it after the php close tag but then the link shows up even when the form doesn't validate. Please help!