Sending emails and insert into trable

Ads
 

Sending emails and insert into trable

I have created a form, once people submit it should go to the email and insert to table also, the second part is working, but it's not getting to configured email. the code is below, I'm I doing anything wrong? I'm not getting any error by the way.

<?php
include"connect.php";

if(isset($_POST['email'])) {

$email_to = "[email protected]"; 
$email_subject = "Here is a message for you"; 


function died($error) { 
echo "We are very sorry, but there were error(s) found with the form you submitted. "; 
echo "These errors appear below.<br /><br />"; 
echo $error."<br /><br />"; 
echo "Please go back and fix these errors.<br /><br />"; 
die(); 
} 


if(!isset($_POST['name']) || 
!isset($_POST['vehicleN']) || 
!isset($_POST['pickup']) || 
!isset($_POST['pickup_date']) || 
!isset($_POST['pickup_time']) || 
!isset($_POST['return']) || 
!isset($_POST['return_date']) || 
!isset($_POST['return_time']) ||
!isset($_POST['email']) ||  
!isset($_POST['mobile']) || 
!isset($_POST['message'])) { 
died('We are sorry, but there appears to be a problem with the form you submitted.');
} 

$vehitype=$_POST['vehicleN'];
$pickup=$_POST['pickup'];
$pdate=$_POST['pickup_date'];
$ptime=$_POST['pickup_time'];
$return=$_POST['return'];
$rdate=$_POST['return_date'];
$rtime=$_POST['return_time']; 
$name = $_POST['name']; 
$email_from = $_POST['email']; 
$mobile = $_POST['mobile']; 
$message = $_POST['message']; 
$error_message = ""; 
$email_exp = '/^[A-Za-z0-9._%-][email protected][A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; 
if(!preg_match($email_exp,$email_from)) { 
$error_message .= 'The Email Address you entered does not appear to be valid.<br />'; 
} 
$string_exp = "/^[A-Za-z .'-]+$/"; 
if(!preg_match($string_exp,$name)) { 
$error_message .= 'The Name you entered does not appear to be valid.<br />'; 
}   
if(strlen($message) < 2) {
$error_message .= 'The Message you entered do not appear to be valid.<br />'; 
}
if(strlen($error_message) > 0) { 
died($error_message); 
}
$email_message = "Form details below.\n\n";     
function clean_string($string) { 
$bad = array("content-type","bcc:","to:","cc:","href"); 
return str_replace($bad,"",$string); 
}
$email_message .= "Vehicle: ".clean_string($vehicleN)."\n"; 
$email_message .= "pickup: ".clean_string($pickup)."\n"; 
$email_message .= "pickup-date: ".clean_string($pickup_date)."\n"; 
$email_message .= "pickup-time: ".clean_string($pickup_time)."\n"; 
$email_message .= "return: ".clean_string($return)."\n"; 
$email_message .= "return-date: ".clean_string($return_date)."\n"; 
$email_message .= "return-time: ".clean_string($return_time)."\n"; 
$email_message .= "Name: ".clean_string($name)."\n"; 
$email_message .= "Email: ".clean_string($email_from)."\n"; 
$email_message .= "Telephone: ".clean_string($mobile)."\n"; 
$email_message .= "Message: ".clean_string($message)."\n"; 

$headers = 'From: '.$email_from."\r\n". 
'Reply-To: '.$email_from."\r\n" . 
'X-Mailer: PHP/' . phpversion(); 
@mail($email_to, $email_subject, $email_message, $headers);

$query="insert into booking set vehiType='$vehitype', datePick='$pdate',timePick='$ptime',dateRet='$rdate',timeRet='$rtime', name='$name', email='$email_from', mob='$mobile', message='$message', areaPick='$pickup', areaRet='$return' ";

mysql_query ($query) or die ('could not updated:'.mysql_error());
header ('Location:sucess.php');
exit()
?>
View Answers

Ads









Related Tutorials/Questions & Answers:
Sending emails and insert into trable
Sending emails and insert into trable  I have created a form, once people submit it should go to the email and insert to table also, the second part...(); @mail($email_to, $email_subject, $email_message, $headers); $query="insert
Sending Emails In Java
Sending Emails In Java  I want to send emails from within a java program. I saw some online java programs to do that, but they needed me to enter a smtp server, but i don't know what that should be. Can someone please help
Advertisements
Sending Emails In Java
Sending Emails In Java  I want to send emails from within a java program. I saw some online java programs to do that, but they needed me to enter a smtp server, but i don't know what that should be. Can someone please help
Sending Emails In Java
Sending Emails In Java  I want to send emails from within a java program. I saw some online java programs to do that, but they needed me to enter a smtp server, but i don't know what that should be. Can someone please help
automatically resend when connection lost in sending email
automatically resend when connection lost in sending email  send automatically email when connection lost in sending bulk email using javamail for exp more than 10000 emails
automatically resend when connection lost in sending email
automatically resend when connection lost in sending email  send automatically email when connection lost in sending bulk email using javamail for exp more than 10000 emails
automatically resend when connection lost in sending email
automatically resend when connection lost in sending email  send automatically email when connection lost in sending bulk email using javamail for exp more than 10000 emails
ModuleNotFoundError: No module named 'emails'
ModuleNotFoundError: No module named 'emails'  Hi, My Python... 'emails' How to remove the ModuleNotFoundError: No module named 'emails'... to install padas library. You can install emails python with following command
ModuleNotFoundError: No module named 'emails'
ModuleNotFoundError: No module named 'emails'  Hi, My Python... 'emails' How to remove the ModuleNotFoundError: No module named 'emails'... to install padas library. You can install emails python with following command
Sending email with read and delivery requests
Sending email with read and delivery requests  Hi there, I am sending emails using JavaMail in Servlets on behalf of a customer from the website, and I'm having difficulty understanding how to implement, read and delivery
How to read unread emails
How to read unread emails  How to read unread emails from account using POP3
ModuleNotFoundError: No module named 'django-emails'
ModuleNotFoundError: No module named 'django-emails'  Hi, My... 'django-emails' How to remove the ModuleNotFoundError: No module named 'django-emails' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'flask-emails'
ModuleNotFoundError: No module named 'flask-emails'  Hi, My Python... 'flask-emails' How to remove the ModuleNotFoundError: No module named 'flask-emails' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'kw-emails'
ModuleNotFoundError: No module named 'kw-emails'  Hi, My Python...-emails' How to remove the ModuleNotFoundError: No module named 'kw-emails' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'py-emails'
ModuleNotFoundError: No module named 'py-emails'  Hi, My Python...-emails' How to remove the ModuleNotFoundError: No module named 'py-emails' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'templated-emails'
ModuleNotFoundError: No module named 'templated-emails'  Hi, My... named 'templated-emails' How to remove the ModuleNotFoundError: No module named 'templated-emails' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'disposable-emails'
ModuleNotFoundError: No module named 'disposable-emails'  Hi, My... named 'disposable-emails' How to remove the ModuleNotFoundError: No module named 'disposable-emails' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'disposable-emails'
ModuleNotFoundError: No module named 'disposable-emails'  Hi, My... named 'disposable-emails' How to remove the ModuleNotFoundError: No module named 'disposable-emails' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'emails-gdpr'
ModuleNotFoundError: No module named 'emails-gdpr'  Hi, My Python... 'emails-gdpr' How to remove the ModuleNotFoundError: No module named 'emails-gdpr' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'emails-gdpr'
ModuleNotFoundError: No module named 'emails-gdpr'  Hi, My Python... 'emails-gdpr' How to remove the ModuleNotFoundError: No module named 'emails-gdpr' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'extract-emails'
ModuleNotFoundError: No module named 'extract-emails'  Hi, My... named 'extract-emails' How to remove the ModuleNotFoundError: No module named 'extract-emails' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'frasco-emails'
ModuleNotFoundError: No module named 'frasco-emails'  Hi, My... 'frasco-emails' How to remove the ModuleNotFoundError: No module named 'frasco-emails' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'hdv_emails'
ModuleNotFoundError: No module named 'hdv_emails'  Hi, My Python... 'hdv_emails' How to remove the ModuleNotFoundError: No module named 'hdv_emails' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'kw-emails'
ModuleNotFoundError: No module named 'kw-emails'  Hi, My Python...-emails' How to remove the ModuleNotFoundError: No module named 'kw-emails' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'templated-emails'
ModuleNotFoundError: No module named 'templated-emails'  Hi, My... named 'templated-emails' How to remove the ModuleNotFoundError: No module named 'templated-emails' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'templated-emails'
ModuleNotFoundError: No module named 'templated-emails'  Hi, My... named 'templated-emails' How to remove the ModuleNotFoundError: No module named 'templated-emails' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'tornado-emails'
ModuleNotFoundError: No module named 'tornado-emails'  Hi, My... named 'tornado-emails' How to remove the ModuleNotFoundError: No module named 'tornado-emails' error? Thanks   Hi, In your python
sending data to facebook
sending data to facebook  how to post data into facebook from a java program
sending mail using jsp
sending mail using jsp  please give me the detailed procedure and code for sending mail through jsp program   Please visit the following links: http://www.roseindia.net/ejb/introduction/j2eedemo.shtml http
How to Disable Catch-all Emails on CPanel
How to Disable Catch-all Emails on CPanel  Hi, How to disable catch all emails setting on CPanel? Thanks
Sending hidden values
Sending hidden values  how to send more than one hidden values through javascript function . Main purpose is to remove href link (Query string should not appear in url bar

Ads