//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 ); //After email insert into database if (isset($result) && isset($result2)) { $message = "Terima kasih untuk minat anda dalam rawatan rambut 101, konsultant akan segera menghubungi anda."; }// end inner if else { $message = "Sila semak dan cuba sekali lagi."; }// end else }//end outer if //**************************************************** END Email forwarding HERE ************** ?>
Tempahlah temujanji dengan kami hari ini
Biarkan kami yang menyelesaikan masalah-masalah rambut anda!
Sila penuhkan semua ruangan dengan betul bagi membolehkan
kami memberi maklum balas kepada anda dengan segera.
Hi Saya Papelli!!!
".$message."
";
}
?>
|