Below is a simple script validation. You must make a seperate page (e.g. mailer.php) and proecess the form using this mailer! You can in sert html below the PHP code for a thank you page. Once the php is processed the html will kick in. Hope it works. Dont forget to make a seperate page and replace all the html with the PHP. It has an auto reply included. It's nice.
<?php
// Receiving variables
@$pfw_ip= $_SERVER['REMOTE_ADDR'];
@$email = addslashes($_POST['email']);
@$name = addslashes($_POST['name']);
// Validation
if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email))
{
die("<p align='center'><font face='Arial' size='5' color='#FF0000'>Error<br><br>Please enter a Valid Email</font></p>");
}
if (strlen($email) == 0 )
{
die("<p align='center'><font face='Arial' size='5' color='#FF0000'>Error<br><br>Please enter a Valid Email</font></p>");
}
//Sending Email to form owner
$pfw_header = "From: $email\n"
. "Reply-To: $email\n";
$pfw_subject = "Your Subject";
$pfw_email_to = "youremail@youraddress.com";
$pfw_message = "Visitor's IP: $pfw_ip\n"
. "email: $email\n";
@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;
//Sending auto respond Email to visitor
$pfw_header = "yourmail@yourmailaddress.com\n"
. "Reply-To:
yourmail@yourmailaddress.com\n";
$pfw_subject = "yourwebsite.com";
$pfw_email_to = "$email";
$pfw_message = "Thank you for contacting your web site.com. If requested a member of managment will get back to you.\n"
. "\n"
. "Staff";
@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;
echo("<p align='center'><font face='Arial' size='3' color='#FF0000'>Thank you</font></p>");
?>