include("tools.php");
global $errors;
global $errorClasses;
global $last_name;
global $first_name;
global $city;
global $state;
global $zip;
global $phone;
global $phone2;
global $email;
global $phone_time;
$phone_time=$_POST["phone_time"];
$first_name=$_POST["first_name"];
$last_name=$_POST["last_name"];
$city=$_POST["city"];
$state=$_POST["state"];
$phone_time=$_POST["$phone_time"];
$zip=$_POST["zip"];
$phone=$_POST["phone"];
$phone2=$_POST["phone2"];
$email=$_POST["email"];
function dispContactForm() {
$title = "Get a free quote from an ADT employee now! home alarm system rates and quote";
$desc = "ADT Security quote for residential home security especially in S. Jersey, Philadelphia, South Jersey, Delaware and new york";
$keywords = "ADT Security quote, home security estimate, home alarm estimate, get a home security estimate";
$header=getHeader($title, $desc, $keywords);
$body.="
";
$footer = getFooter();
echo "$header $body $footer";
}
if ($_POST["submitbtn"] != "Submit") {
$submitbtn = $_POST["submitbtn"];
echo "SUBMIT: $submitbtn
";
dispContactForm();
}
else {
$errorClasses=array();
$errors=array();
$validForm = 1;
if ($first_name=="") {
$errors[]="Please enter a first name ";
$errorClasses["firstname"] = "error";
$validForm = 0;
echo "GOT first
";
}
if ($last_name=="") {
$errors[]="Please enter a last name ";
$errorClasses["lastname"] = "error";
$validForm = 0;
echo "GOT last
";
}
if ($city == "") {
$errors[]="Please enter a valid city ";
$errorClasses["city"] = "error";
echo "GOT city
";
$validForm = 0;
}
if ($state == "not_given") {
$errors[]="Please choose a valid state ";
$errorClasses["state"] = "error";
echo "GOT state
";
$validForm = 0;
}
if ($phone_time == "not_given") {
$errors[]="Please choose a valid time.";
$errorClasses["phone_time"] = "error";
echo "GOT phone
";
$validForm = 0;
}
if ($zip =="") {
$errors[]="Please enter a valid zip code ";
$errorClasses["zip"] = "error";
echo "GOT zip
";
$validForm = 0;
}
if (checkPhone($phone,$phoneError) == 0) {
echo "GOT phone CHECK PHONE FUNCTION
";
$errors[]=$phoneError;
$validForm = 0;
$errorClasses["phone"]="error";
}
if (checkPhone($phone2,$phoneError) == 0) {
echo "GOT phone CHECK PHONE FUNCTION 2
";
$errors[]=$phoneError;
$validForm = 0;
$errorClasses["phone2"]="error";
}
if (checkEmail($email) == 0) {
echo "GOT EMAIL CHECK PHONE FUNCTION
";
$errors[]="Please enter a valid email address i.e. tom@goodtimetickets.com";
$validForm = 0;
$errorClasses["email"] = "error";
}
if ($validForm == 0) {
echo "GOT phone CHECK FORM FUNCTION
";
dispContactForm();
}
else {
$ip = GetHostByName($REMOTE_ADDR);
$ref = $_SERVER['HTTP_REFERRER'];
$phone_time = $_POST["phone_time"];
mail("info@vanillaafro.com","SALES LEAD submitted on ".gmdate('l, F j, Y', time()),"
newsletter - news contacts for ADT security lead:
\n\n
email: $email \n
name: $first_name $last_name \n
city: $city \n
state: $state_return - $state \n
zip: $zip\n
phone: $phone\n
second phone: $phone2\n
best time to call: $phone_time \n
referer: $ref \n
ip address: $ip \n
");
mail("info@vanillaafro.com","SALES LEAD submitted on ".gmdate('l, F j, Y', time()),"
\n\n
email: $email \n
name: $first_name $last_name \n
city: $city \n
state: $state_return - $state \n
zip: $zip\n
phone: $phone\n
second phone: $phone2\n
best time to call: $phone_time \n
");
header("location:http://www.adtpros.com/thanks.html");
}
}
?>