I am a noob, I know ;) Anywho, I am trying to create a form validation and when it is successful, it says "Thank you. Success" or whatever. It's a basic form on a page that has an action of "POST". Here is the code on the processing FORM. Also, in the "If empty" segments, is there a code I can use for the Go Back button instead of putting in a hyperlink?
<?
If (empty($_POST['first_name']))
{
$errors[] = '<div class="goback">Please enter a name.<br><br><a href="http://www.xxxxxxxx.com/contact">Go Back</a></div>';
}
if (empty($_POST['email']))
{
$errors[] = '<div class="goback">Please enter an email address.<br><br><a href="http://www.xxxxxxxxx.com/contact">Go Back</a></div>';
}
else if (!eregi("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$", $_POST['email']))
{
$errors[] = '<div class="goback">Please enter a valid email address.<br><br><a href="http://www.xxxxxxxxx.com/contact">Go Back</a></div>';
}
if (count($errors) == 0)
{
// Process form
}
else
{
echo $errors[0];
}
?><?
mail("XXXXX@XXXXX.com", "Jonathan Website Form", "
First Name: $first_name
Last Name: $last_name
Email: $email
Phone: $phone
Interested In: $interest
I Want To Tell You: $comment,");
?>