//**************** Contact Us File
if(isset($_POST['submit'])){
$subject = "Help us";
// Status variable
$Status_var = "";
if( isset($_POST['name']) && !empty($_POST['name'])){
if(preg_match('/^[A-Za-z\s]+$/',$_POST['name'])){
$name = trim($_POST['name']);
}else{
$name_error = '<b class="text-danger text-center">Please
enter correct Name</b>';
}
}else{
$name_error = '<b class="text-danger text-center">Please fill the
Name field</b>';
}//name if condition
if(isset($_POST['phone']) && !empty($_POST['phone'])){
if(preg_match("/^([0-9]+)$/",$_POST['phone'])){
$phone = trim($_POST['phone']);
}else{
$phone_error = '<b class="text-danger text-center">Please
enter only degit numbers</b>';
}
}else{
$phone = "User Not Send";
}// phone if condition
if(isset($_POST['email']) && !empty($_POST['email'])){
if(preg_match("/^[^@ ]+@[^@ ]+\.[^@ \.]+$/",$_POST['email'])){
$email = trim($_POST['email']);
}else{
$mail_error = '<b class="text-danger text-center">Please enter
valid Email</b>';
}
}else{
$mail_error = '<b class="text-danger text-center">Please
fill Email field</b>';
}// mail if condition
if( isset($_POST['msg']) && !empty($_POST['msg']) ){
$user_msg = trim($_POST['msg']);
}else{
$message_error = '<b class="text-danger text-center">Please fill
the Message field.</b>';
} // end of Message
if( ( isset($name) && !empty($name) ) && ( isset($email) && !
empty($email) ) && ( isset($user_msg) && !empty($user_msg) ) && ( isset($phone)
&& !empty($phone) ) ) {
// preparing mail body
$message = "Email:".$email."\n";
$message .= "Name:".$name."\n";
$message .= "Phone:".$phone."\n";
$message .= "Message:".$user_msg."\n";
if(mail($to,$subject,$message)){
$success= "<div class='alert alert-sucess'> Thank You For Your
Feedback. <br>We Are Here For Achieve Your Expectations.<a class='close' data-
dismiss='alert'>×</a></div>";
} else {
$send_error = '<b class="text-danger text-center">Fail to send
Mail. Please check Your Email Address, Name & Fill the message BOX. </b>';
}
$header = "[email protected]";
$subject = "Thank You $name";
$message = "We are here for achieve your expectations. \nThank you for
your FEEDBACK Form Exceptional Programmars.\n CEO EP";
$to = $email; //Programmers email
if(mail($to,$subject,$message,$header)){
$success= "<div class='alert alert-sucess'> Thank You For Your
Feedback <br>We Are Here For Achieve Your Expectations.<a class='close' data-
dismiss='alert'>×</a></div>";
} else {
$send_error = '<b class="text-danger text-center">Fail to send
Mail. Please check Your Email Address, Name & Fill the message BOX. </b>';
}
}
} // Submit If
include("header.php");