//Include the database connection include("scripts/database_connection.php"); // Create script for forwarding to email $message=""; function nullCheck($str) { if(strlen($str) == 0) { return "Not filled"; } else { return $str; } } //Check to see if the form fields are filled in server side checking if(isset($_POST['name'])){ $name = "'" . nullCheck($_POST['name']) ."'"; $icno = "'" . nullCheck($_POST['icno']) ."'"; $gender = "'" . nullCheck($_POST['gender']) ."'"; $dob= "'" . nullCheck($_POST['dob']) ."'"; $email = "'" . nullCheck($_POST['email']) ."'"; $phone = "'" . nullCheck($_POST['phone']) ."'"; $hair= "'" . nullCheck($_POST['hair']) ."'"; $outlet = "'" . nullCheck($_POST['outlet']) ."'"; $date = "'" . nullCheck($_POST['date']) ."'"; $time = "'" . nullCheck($_POST['time']) ."'"; $query = "INSERT INTO contact ( name , icno, gender , dob , email , phone , hair , outlet , bookingdate , bookingtime , enquirydate,status,showstatus) VALUES ($name,$icno,$gender,$dob,$email,$phone,$hair,$outlet,$date,$time,NOW(),'Not Contacted',1);"; // This die method gives us more clues if things go wrong $result2 = ConnectDB($query) or die ("ack! query failed:" ."
We have a new consultation please find the details below | |
Name: | ".clean_string($name)." |
DOB: | ".clean_string($dob)." |
IC No: | ".clean_string($icno)." |
Gender: | ".clean_string($gender)." |
Email: | ".clean_string($email)." |
Phone Number: | ".clean_string($phone)." |
Hair Problem: | ".clean_string($hair)." |
Outlet: | ".clean_string($outlet)." |
Preferred Date: | ".clean_string($date)." |
Preferred Time: | ".clean_string($time)." |
Thank you, this is auto-generated
";
$email_message .= '';
$result = mail( $to, "Subject: $subject",$email_message, $headers );
if (isset($result) && isset($result2)) {
$message = "感谢您对101 HAIRCARE 感兴趣,
顾问将尽快与您联系。";
}// end inner if
else {
$message = "请检查您的详细资料,然后再试一次。";
}// end else
}//end outer if
//**************************************************** END Email forwarding HERE **************
?>
预约免费咨询
让我们为您解决头发问题!今天就与我们预约!
请填写以下资料以让我们可以尽快回复您。
你好,我叫毛球仔!
".$message."
";
}
?>
|