Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa PHP Sending emails and insert into trable

Have Programming Question? Ask it here!
 
 
 


Haneef Thayyil
Sending emails and insert into trable
0 Answer(s)      10 months ago
Posted in : PHP


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 = "myemail@gmail.com"; 
$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._%-]+@[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()
?>

Advertisement
View Answers

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 - JavaMail
sending emails  what is the code for sending emails in java  Hi Friend, Please visit the following link: http://www.roseindia.net/javamail/ Hope that it will be helpful for you. Thanks
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
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
How to read unread emails
How to read unread emails  How to read unread emails from account using POP3
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 email code - JSP-Servlet
sending email code  How To Send Emails using jsp  Hi friend, I am sending you a link. This link will help you. Please visit for more information. http://www.roseindia.net/mail/sending-an-email
insert
insert  insert data in database from servlet through JDBC   Ho Friend, Please visit the following: Insert data into database Thanks
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
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
Sending File - JSP-Servlet
Sending File  How to use tag in Jsp, & How read a file fom Client  Hi Friend, We used tag to upload a file. Please visit...://www.roseindia.net/jsp/upload-insert-csv.shtml Hope that it will be helpful for you
sending mails - JSP-Servlet
sending mails  my intension is sending mails through java program with out installing any softwares.what is code
sending mail - JSP-Servlet
sending mail  Hi, what is the code for sending mail automatically without user intervention? thanks in advance
Sending mail - JavaMail
Sending mail  Need a simple example of sending mail in Java ... emails using outlook client.From java program you can also send email.Here is an example code to send emails:import java.util.*;import javax.mail.*;import
sending mails - JSP-Servlet
sending mails   sending mail using smtp protocal ,while running,i got error an javax.mail.sendfailed exception. what is this error
how to send emails to many using jsp by connecting to ms access dabase.
how to send emails to many using jsp by connecting to ms access dabase.  Hi. I am trying to send multiple emails and the email ids are stored in a table in a msaccess database.I am using jsp for this.And finally there should
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
Sending email without authentication
Sending email without authentication  Hi sir, Am doing a project in JSP, in that i want to send mail without any authentication of password so send.../mail/sending-an-email-in-jsp.shtml
code for user registration page and login page of emails using jsp
code for user registration page and login page of emails using jsp  hiiiiiii please send me the code for user registration page and login page of email using jsp and servlets and also code for database connectivity to oracle
sending a mail - JSP-Servlet
sending a mail   I m writing a code for send mail in jsp,i sending a mail to specified receiver but if i attach an file and send a mail then i m getting an error. Here Attachment is in String[] Attachment=null so how
for sending project build
for sending project build  hello I want to send my iphone project build to someone else how can i send it...   yes you can send but Follow the steps on the portal to creating an ad hoc build and certificate. Look
java mail sending with images
java mail sending with images  I need to send images through java mail without giving content path(i.e. we don't want hard code the image path)can you tell me the idea?   Please visit the following links: http
sending a zip file to servlet
sending a zip file to servlet  I have created a .zip file in a servlet on the local system(no static ip). The .zip file contains xml files. I have to send it to another servlet which is in a server(has a static ip). I have done
sending automatic email - JavaMail
sending automatic email  Dear sir. In my project i need to send an automatic email to the clients when their accounts are going to expire in 30 days.i am using jsp,mysql and tomcat for my project.Expire information are stored
regarding sending mesage - JavaMail
regarding sending mesage  i have tried the following program /* import java.util.*; import javax.mail.*; import javax.mail.internet.*; import... me in this regard   Hi friend, I am sending you a link
iphone mail sending problem
iphone mail sending problem  Hi, I'm receiving the following error ... while sending mail in my iphone application Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[viewController
sending sms from laptop to mobile
sending sms from laptop to mobile   sending sms from laptop to mobile for multi users
sending sms from laptop to mobile
sending sms from laptop to mobile   sending sms from laptop to mobile for multi users
Sending an email in JSP
Sending an email in JSP       Sending an email in JSP In this section, you will learn how to send an email in jsp.   Following is a simple JSP page for sending
sending commands through RxTx
sending commands through RxTx  i am trying to call lightOn and LightOff method from NewSerialWriter's run() method but not able to make the correct logic. please help me with this. here is my code of different classes. package
File and data sending
f = new File(saveFile); psmnt = connection.prepareStatement("insert into file
sending doc files - Swing AWT
sending doc files  how to send doc file using java from one machine to other over a network
sending sms with help of java - JavaMail
sending sms with help of java  hi can u plz help me to learn how to send sms with help of java. waiting for your reply
Sending SMS From Java Programs
Sending SMS From Java Programs  I want to develop and application to send sms from my computer, can someone please help me, like tell me where to start and what i need
code for sending email using j2me
code for sending email using j2me  could someone tell me why when i try to compile this line using netbeans 7.1 Properties property... for sending a file attachment to gmail account
Sending images through java mail
Sending images through java mail  Am trying to develop greeting application that having images..... in one jsp page i displayed all images and by clicking one image the control go to mail sending page in that the image should add
Sending mail (Contact Form in a website)
Sending mail (Contact Form in a website)  Hi, I just uploaded few of my webpages into a free web hosting service, where i can just upload the web pages. Am very much new into this field. I want to write a contact form, which
Email sending in jsp - JSP-Servlet
Email sending in jsp  Hi, Im trying to send email from my jsp... i've already tried a sample code from google, for sending email to my office 'smtp... attached the whole coding as below: For input :index.jsp Sending
Sending query with variable - JSP-Servlet
Sending query with variable   While displaying pages in frames concept, one page contains links and other page contains messages for that links. The links page is not static one. Links page displays the contents from
sending mail with attachment in jsp - JSP-Servlet
sending mail with attachment in jsp  Hi Experts
SMS sending questions using java - MobileApplications
SMS sending questions using java  am doing project sending SMS from pc.how to send bulk SMS ?i achive sending single SMS .but i would like to send bulk SMS.am using mobile phone for sending SMS.is it possible sending bulk SMS
sending email using smtp in java
sending email using smtp in java  Hi all, I am trying to send and email to through my company mail server. Following is my code package com.tbss; import javax.mail.*; import javax.mail.internet.*; import
java code for sending sms - JSP-Servlet
java code for sending sms  hello sir, I want a code for sending sms on mobile . please send me if u have this Thanks & regards Dharmendra
message sending and receiving using UDP TCP in J2ME
message sending and receiving using UDP TCP in J2ME   I need the simple program for message sending and receiving using UDP TCP in J2ME. Could u pls
sending data from java to facebook wall
sending data from java to facebook wall  how to send data form a java program to facebook wall
jdbc insert
jdbc insert  Hi , i want to insert a declared integer variable into a mysql table through jdbc. how to insert that. help me with query... thanks... a table there. After creating a table in database, it insert a rows in the database
Advertisements
 

 

 

DMCA.com