Hi thank you for your help, I am going to examine your code and test it, but earlier today I got another solution,
here it is:
<?php
$name = trim(htmlentities($_POST['name'],ENT_QUOTES,'utf-8'));
$company = trim(htmlentities($_POST['company'],ENT_QUOTES,'utf-8'));
$email = trim(htmlentities($_POST['email'],ENT_QUOTES,'utf-8'));
$phone = trim(htmlentities($_POST['phone'],ENT_QUOTES,'utf-8'));
$interest = trim(htmlentities($_POST['interest'],ENT_QUOTES,'utf-8'));
$comments = trim(htmlentities($_POST['comments'],ENT_QUOTES,'utf-8'));
if($name != '' && $company != '' && $email != '' && $phone != ''){
$to = "me@mysite.com";
$subject = "Visitor Contact";
$message = "Name: ".$name;
$message.="\n\nCompany: ".$company;
$message.="\n\nEmail: ".$email;
$message.="\n\nPhone: ".$phone;
$message.="\n\nInterest: ".$interest;
$message .= "\n\nMessage: ".$comments;
$headers = "From: $email";
$headers .="\nReply-To: $email";
$success = mail($to, $subject, $message, $headers);
if ($success) {
print ("<b>Thank you $name. You'll be hearing from us soon.</b>");
} else {
print ("<b>I'm sorry, there was a technical glitch, please send your email to me@gmysite.com directly.</b>");
}
}
else
{
echo "Please fill the required fields, thankyou";
}
?>
This seems to work so I am using this, but maybe after I look at it closer, I like yours better?
Anyway, I am learning and that is good.
Thank you!