On Mon, 12 Jul 2004 20:40:07 +0000 (UTC),
"jennsite" <webforumsuser (AT) macromedia (DOT) com> wrote:
Quote:
ok. fixed the onClick thing. |
Try this:
<?php
//trim whitespace
$name=stripslashes(trim($_POST['name']));
$email=stripslashes(trim($_POST['email']));
$company=stripslashes(trim($_POST['company']));
$message=stripslashes(trim($_POST['message']));
//check email is valid
if (!eregi("^[a-zA-Z0-9_\-\.\-\\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$", $email))
{
echo "You have entered an invalid email address. Please return to the previous page and try again.";
exit;
}
//set headers and format email content
$headers = "From: Courtroom Video: Website Enquiry <jennsite (AT) geary (DOT) k12.ok.us>\n";
$headers .= "Reply-To: ".$email."\n";
$headers .= "X-Sender: <jennsite (AT) geary (DOT) k12.ok.us>\n";
$headers .= "X-Mailer: PHP4\n";
$headers .= "X-Priority: 3\n";
$headers .= "Return-Path: <jennsite (AT) geary (DOT) k12.ok.us>\n";
$toaddress = "jennsite (AT) geary (DOT) k12.ok.us";
$mailcontent = "Customers Name: ".$name." \r\n"
."Customers Email: ".$email."\r\n"
."Customers Company: ".$company."\r\n"
."Message: ".$message."\r\n";
//process email and warn if errors encountered
if(mail($toaddress,"Website enquiry from ".$name,$mailcontent,$headers) == true) {
$deliverymessage = "<b>Thank you, your enquiry about our services has been successfully sent, expect a response within one business day.</b>";
}
else {
$deliverymessage = "<b>Sorry, there has been an error with your request.</b> Please press the back button on your browser and try again.";
}
?>
Gary