<?php

   session_start();
   if(($_SESSION['security_code'] == $_POST['security_code']) && (!empty($_SESSION['security_code'])) ) {
      
// Original Form Email script

header("Location: thankyou.html");

// Build up the email message

$message.="Customer Name: $_POST[First_Name] $_POST[Last_Name]\n";
$message.="Company Name: $_POST[Company_Name]\n";
$message.="\n";
$message.="Preferred Contact: $_POST[Preferred_Contact]\n";
$message.="Email: $_POST[Email]";
if ($_POST[Preferred_Contact]=="E-mail") $message.=" ** preferred **";
$message.="\n";
$message.="Day Phone: $_POST[Day_Phone]";
if ($_POST[Preferred_Contact]=="Day Phone") $message.=" ** preferred **";
$message.="\n";
$message.="Evening Phone: $_POST[Evening_Phone]";
if ($_POST[Preferred_Contact]=="Evening Phone") $message.=" ** preferred **";
$message.="\n";
$message.="Fax Number: $_POST[Fax_Number]";
if ($_POST[Preferred_Contact]=="Fax") $message.=" ** preferred **";
$message.="\n";
$message.="\n";
$message.="Service Address:\n";
if ($_POST[Service_Address]<>"") $message.="$_POST[Service_Address]\n";
if ($_POST[Service_City]<>"") $message.="$_POST[Service_City]\n";
if ($_POST[Service_State]<>"") $message.="$_POST[Service_State]\n";
if ($_POST[Service_Zip]<>"") $message.="$_POST[Service_Zip]\n";
$message.="\n";
$message.="Referred by: $_POST[Referred_by]\n";
$message.="Contact Requested: $_POST[Contact_Requested]\n";
$message.="Service Type: $_POST[Service_Type]\n";
$message.="\n";
$message.="Services Needed:\n";
if ($_POST[Carpet_Cleaning]) $message.="Carpet Cleaning\n";
if ($_POST[Area_Rug]) $message.="Area Rug Cleaning\n";
if ($_POST[Upholstery]) $message.="Upholstery Cleaning\n";
if ($_POST[Pets]) $message.="Pet urine and/or odors\n";
$message.="\n";
$message.="Areas to be cleaned:\n";
if ($_POST[CleanLivingRoom]) $message.="Living Room\n";
if ($_POST[CleanDinningRoom]) $message.="Dinning Room\n";
if ($_POST[CleanFrontRoom]) $message.="Front Room\n";
if ($_POST[CleanDenOffice]) $message.="Den / Office\n";
if ($_POST[CleanHall]) $message.="Hall\n";
if ($_POST[CleanKitchen]) $message.="Kitchen\n";
if ($_POST[CleanStairs]) $message.="Stairs\n";
if ($_POST[Bedrooms] > 0) $message.="$_POST[Bedrooms] Bedroom";
if ($_POST[Bedrooms] > 1) $message.="s";
if ($_POST[Bedrooms] > 0) $message.="\n";
if ($_POST[Other_Cleaning] <> "") $message.="Other: $_POST[Other_Cleaning]\n";
$message.="\n";
if ($_POST[App1_Date]<>"") $message.="Appointment 1: $_POST[App1_Date] $_POST[App1_Time]\n";
if ($_POST[App2_Date]<>"") $message.="Appointment 2: $_POST[App2_Date] $_POST[App2_Time]\n";
if ($_POST[App1_Date]<>"" OR $_POST[App2_Date]<>"")$message.="\n";
$message.="Notes:\n$_POST[Notes]\n";

// Build up the rest of the email information
$to = "chemdryselect@hotmail.com";

if ($_POST[URGENT])
  $subject = "ChemDry - New Contact ** URGENT ***";
else
  $subject = "ChemDry - New Contact";

$headers = "From: Appointment@Chemdry.ca";

// Send the email
mail($to, $subject, $message, $headers);

 
      unset($_SESSION['security_code']);

   } else {

      // Insert your code for showing an error message here

	echo "<h1><DIV align=center>I'm sorry, you have provided an invalid security code.<br/>Please press BACK and try again, thank you.</div></h1>"  ;
   }
?>







