PHP - Email Form Can Only Be Sended If The Form Contains A @
As the topis says, I need help with an email form.
You must have valid email address to go further, so lets say you write asdada as email, you won't be able to register the account, you must have asdada@hotmai.com or something like that. If anyone knows it would be awesome! Similar TutorialsHi all, What I am trying to achieve is, I thought quite simple! Basically, a user signs up and chooses a package, form is submitted, details added to the database, email sent to customer, then I want to direct them to a paypal payment screen, this is where I am having issues! Is their any way in php to submit a form without user interaction? Here is my code for the form process page Code: [Select] <?php include('config.php'); require('scripts/class.phpmailer.php'); $package = $_POST['select1']; $name = $_POST['name']; $email = $_POST['email']; $password = md5($_POST['password']); $domain = $_POST['domain']; $a_username = $_POST['a_username']; $a_password = $_POST['a_password']; $query=mysql_query("INSERT INTO orders (package, name, email, password, domain, a_username, a_password) VALUES ('$package', '$name', '$email', '$password', '$domain', '$a_username', '$a_password')"); if (!$query) { echo "fail<br>"; echo mysql_error(); } else { $id = mysql_insert_id(); $query1=mysql_query("INSERT INTO customers (id, name, email, password) values ('$id', '$name', '$email', '$password')"); if (!$query1) { echo "fail<br>"; echo mysql_error(); } if($package=="Reseller Hosting") { //email stuff here - all works - just cutting it to keep the code short if(!$mail->Send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; } ?> <form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick-subscriptions"> <input type="hidden" name="business" value="subscription@jollyhosting.com"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="item_name" value="Jolly Hosting Reseller Packages"> <input type="hidden" name="no_shipping" value="1"> <!--1st month --> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="a3" value="3.00"> <input type="hidden" name="p3" value="1"> <input type="hidden" name="t3" value="M"> <input type="hidden" name="src" value="1"> <input type="hidden" name="sra" value="1"> </form>'; <?php } //last } //end ?> Hello, I am working with a SMTP class to send an email. It's all working perfectly fine, but when the email is received (sent from the online form), and I open my email and click reply, there are two email addresses. The correct one (which I entered when I sent the email), and my ftp username for the site?? I've got three files that could effect this, but I was unable to locate any problems: mailer.php ( smtp send mail class) mail.php ( submission data: title, subject, etc. ) contact_form.php ( form for submission ) I am only including the file which I think is applicable (mail.php), but let me know if you would also like to see the mailer.php class. Current output: reply-to ftpusername@domainname.com, correct_from_email@fromemail.com mail.php: <?php set_time_limit(120); function sendHTMLmail($from, $to, $subject, $message) { $message = wordwrap($message, 70); // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= "From: $from\r\n"; // Mail it mail($to, $subject, $message, $headers); } function sendHTMLmail2($fromid, $to, $subject, $message) { echo $fromid; echo $to; echo $subject; echo $message; include_once("mailer.php"); $mail = new PHPMailer(); $mail->IsMail(); // SMTP servers $mail->Host = "localhost"; $mail->From = $fromid; $mail->FromName = $fromid; $mail->IsHTML(true); $mail->AddAddress($to, $to); $mail->Subject = $subject; $mail->Body = $message; $mail->AltBody = "Please enable HTML to read this"; $mail->Send(); exit; } function isValidEmail($email) { return eregi("^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3}$", $email); } class smtp_mail { var $host; var $port = 25; var $user; var $pass; var $debug = false; var $conn; var $result_str; var $charset = "utf-8"; var $in; var $from_r; //mail format 0=normal 1=html var $mailformat = 0; function smtp_mail($host, $port, $user, $pass, $debug = false) { $this->host = $host; $this->port = $port; $this->user = base64_encode($user); $this->pass = base64_encode($pass); $this->debug = $debug; $this->socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); if ($this->socket) { $this->result_str = "Create socket:" . socket_strerror(socket_last_error()); $this->debug_show($this->result_str); } else { exit("Initialize Faild,Check your internet seting,please"); } $this->conn = socket_connect($this->socket, $this->host, $this->port); if ($this->conn) { $this->result_str = "Create SOCKET Connect:" . socket_strerror(socket_last_error()); $this->debug_show($this->result_str); } else { exit("Initialize Faild,Check your internet seting,please"); } $this->result_str = "Server answer:<font color=#cc0000>" . socket_read($this->socket, 1024) . "</font>"; $this->debug_show($this->result_str); } function debug_show($str) { if ($this->debug) { echo $str . "<p>\r\n"; } } function send($from, $to, $subject, $body) { if ($from == "" || $to == "") { exit("type mail address please"); } if ($subject == "") $sebject = "none title"; if ($body == "") $body = "none content"; $All = "From:$from;\r\n"; $All .= "To:$to;\r\n"; $All .= "Subject:$subject;\r\n"; if ($this->mailformat == 1) { $All .= "Content-Type:text/html;\r\n"; } else { $All .= "Content-Type:text/plain;\r\n"; } $All .= "Charset:" . $this->charset . ";\r\n\r\n"; $All .= " " . $body; $this->in = "EHLO HELO\r\n"; $this->docommand(); $this->in = "AUTH LOGIN\r\n"; $this->docommand(); $this->in = $this->user . "\r\n"; $this->docommand(); $this->in = $this->pass . "\r\n"; $this->docommand(); if (!eregi("235", $this->result_str)) { $this->result_str = "smtp auth faild"; $this->debug_show($this->result_str); return 0; } $this->in = "MAIL FROM: $from\r\n"; $this->docommand(); $this->in = "RCPT TO: $to\r\n"; $this->docommand(); $this->in = "DATA\r\n"; $this->docommand(); $this->in = $All . "\r\n.\r\n"; $this->docommand(); if (!eregi("250", $this->result_str)) { $this->result_str = "Send mail faild!"; $this->debug_show($this->result_str); return 0; } $this->in = "QUIT\r\n"; $this->docommand(); socket_close($this->socket); return 1; } function docommand() { socket_write($this->socket, $this->in, strlen($this->in)); $this->debug_show("Client command:" . $this->in); $this->result_str = "server answer:<font color=#cc0000>" . socket_read($this->socket, 1024) . "</font>"; $this->debug_show($this->result_str); } } ?> Hi the user fill details and then the email his sent to me the only problem is that the emails keeps going to my spam, can someone help me out please I looked already php website and email format looks the same. This is the link to my form. http://www.people.eurico.co.uk/ here my form script Code: [Select] <?php // Set email variables $email_to = 'xxxxx@xxxxxxx.co.uk'; $email_subject = 'Call back form'; // Set required fields $required_fields = array('fullname','email','telephone','comment'); // set error messages $error_messages = array( 'fullname' => 'Please enter a Name to proceed.', 'email' => 'Please enter a valid Email.', 'telephone' => 'Please telephone.', 'comment' => 'Please enter your Message to continue.' ); // Set form status $form_complete = FALSE; // configure validation array $validation = array(); // check form submittal if(!empty($_POST)) { // Sanitise POST array foreach($_POST as $key => $value) $_POST[$key] = remove_email_injection(trim($value)); // Loop into required fields and make sure they match our needs foreach($required_fields as $field) { // the field has been submitted? if(!array_key_exists($field, $_POST)) array_push($validation, $field); // check there is information in the field? if($_POST[$field] == '') array_push($validation, $field); // validate the email address supplied if($field == 'email') if(!validate_email_address($_POST[$field])) array_push($validation, $field); } // basic validation result if(count($validation) == 0) { // Prepare our content string $email_content = 'peoplesmartlearning.co.uk: ' . "\n\n"; // simple email content foreach($_POST as $key => $value) { if($key != 'submit') $email_content .= $key . ': ' . $value . "\n"; } // if validation passed ok then send the email mail($email_to, $email_subject, $email_content); // Update form switch $form_complete = TRUE; } } function validate_email_address($email = FALSE) { return (preg_match('/^[^@\s]+@([-a-z0-9]+\.)+[a-z]{2,}$/i', $email))? TRUE : FALSE; } function remove_email_injection($field = FALSE) { return (str_ireplace(array("\r", "\n", "%0a", "%0d", "Content-Type:", "bcc:","to:","cc:"), '', $field)); } ?> The HTML Code: [Select] <div class="call_us_form"> <p class="title">WE'LL CALL YOU BACK</p> <?php if($form_complete === FALSE): ?> <form class="contact_form" id="fm-form" method="post" action="index.php" > <fieldset> <div class="fm-req"> <label for="fm-firstname">Name</label> <input type="text" id="fullname" class="detail" name="fullname" value="<?php echo isset($_POST['fullname'])? $_POST['fullname'] : ''; ?>" /> <?php if(in_array('fullname', $validation)): ?><script type="text/javascript">alert("Please enter a Name"); history.back();</script><?php endif; ?> </div> <div class="fm-req"> <label for="fm-firstname">Email</label> <input type="text" id="email" class="detail" name="email" value=" <?php echo isset($_POST['email'])? $_POST['email'] : ''; ?>" /> <?php if(in_array('email', $validation)): ?><script type="text/javascript">alert("Please enter a valid Email Address"); history.back();</script><?php endif; ?> </div> <div class="fm-req"> <label for="fm-firstname">Number</label> <input type="text" id="telephone" class="detail" name="telephone" value="<?php echo isset($_POST['telephone'])? $_POST['telephone'] : ''; ?>" /> <?php if(in_array('telephone', $validation)): ?><script type="text/javascript">alert("Please enter telephone number"); history.back();</script><?php endif; ?> </div> <div class="fm-req"> <label for="fm-lastname">Message</label> <textarea cols="40" rows="5" id="comment" name="comment" class="mess"><?php echo isset($_POST['comment'])? $_POST['comment'] : ''; ?></textarea> <?php if(in_array('comment', $validation)): ?><script type="text/javascript">alert("Please enter your message"); history.back();</script><?php endif; ?> </div> <input class="submit_button" type="submit" value="Call us" /> </fieldset> </form> <?php else: ?> <p>Thank you for your Message!</p> <p>We will get back to you as soon as we can</p> <script type="text/javascript"> setTimeout ('ourRedirect()', 5000) function ourRedirect () { location.href='index.php' } </script> <?php endif; ?> I have a form on our website that a user can fill out for custom product. I want the form data to be 1) stored into a mysql database AND after storing said data, 2) email the same data to our sales department. 1) The form data DOES get stored into mysql database (except for the first two fields, for some weird reason) 2) I added a "mail" section to the php file that stores the data into the database, but it is not working correctly. I have stripped the email portion down to sending just one of the fields in the "message" to make it easier for troubleshooting I have included here, both the form section of the html file, and the formdata.php file that processes the data for your analysis. I am relatively new to php so there are going to be some issues with security, but I can work on those after I get the store & email process to work correctly. Please review my code and see if anyone can be of assistance. I looked through the forums and couldn't find another issue that was the same as mine. If I just overlooked, please tell me the thread post #. Thanks THE FORM WHICH COLLECTS THE DATA ******************************* <form method=POST action=formdata.php> <table width="640" border=0 align="center"> <tr> <td align=right><b>First Name</b></td> <td><input type=text name=FName size=25></td> <td><div align="right"><b>Telephone</b></div></td> <td><input type=text name=Tel size=25></td> </tr> <tr> <td align=right><b>Last Name</b></td> <td><input type=text name=LName size=25></td> <td><div align="right"><b>Fax</b></div></td> <td><input type=text name=Fax size=25></td> </tr> <tr> <td align=right><b>Title</b></td> <td><input type=text name=Title size=25></td> <td><div align="right"><b>Email</b></div></td> <td><input type=text name=Email size=50></td> </tr> <tr> <td align=right><b>Company</b></td> <td><input type=text name=Comp size=25></td> <td> </td> <td> </td> </tr> <tr> <td align=right><b>Address</b></td> <td><input type=text name=Addr size=25></td> <td><div align="right"><b>Estimated Annual Volume</b></div></td> <td><input type=text name=EAV size=25></td> </tr> <tr> <td align=right><b>City</b></td> <td><input type=text name=City size=25></td> <td> </td> <td> </td> </tr> <tr> <td align=right><b>State/Province</b></td> <td><input type=text name=SProv size=25></td> <td><div align="right"><b>Application</b></div></td> <td><input type=text name=Appl size=25></td> </tr> <tr> <td align=right><b>Country</b></td> <td><input type=text name=Ctry size=25></td> <td><div align="right"><b>Type of System</b></div></td> <td><input type=text name=Syst size=25></td> </tr> <tr> <td align=right><b>Zip/Postal Code</b></td> <td><input type=text name=ZPC size=25></td> <td> </td> <td> </td> </tr> <tr> <td align=right> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td align=right> </td> <td><div align="right"><strong><font color="#FFFF00" face="Arial, Helvetica, sans-serif">COIL DESIGN</font></strong></div></td> <td><font color="#FFFF00" face="Arial, Helvetica, sans-serif"><strong>PARAMETERS</strong></font></td> <td> </td> </tr> <tr> <td align=right> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td align=right><b>Primary Resistance (ohms)</b></td> <td><input type=text name=Pres size=25></td> <td><div align="right"><b>Primary Inductance (mH)</b></div></td> <td><input type=text name=Pind size=25></td> </tr> <tr> <td align=right><b>Secondary Resistance (ohms)</b></td> <td><input type=text name=Sres size=25></td> <td><div align="right"><b>Secondary Inductance (H)</b></div></td> <td><input type=text name=Sind size=25></td> </tr> <tr> <td align=right> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td align=right><b>Peak Operating Current (Amps)</b></td> <td><input type=text name=POC size=25></td> <td> </td> <td> </td> </tr> <tr> <td align=right> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td align=right><b>Output Energy (mJ)</b></td> <td><input type=text name=Egy size=25></td> <td><div align="right"><b>Output Voltage (kV)</b></div></td> <td><input type=text name=Volt size=25></td> </tr> <tr> <td align=right> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td align=right><b># HV Towers per Coil</b></td> <td><input type=text name=TPC size=25></td> <td><div align="right"><b># of Coils per Package</b></div></td> <td><input type=text name=CPP size=25></td> </tr> <tr> <td align=right> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td align=right> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <th colspan=4><b>Please enter any additional information he </b></th> </tr> <tr> <th colspan=4><textarea name=Mess cols=50 rows=10 id="Message"></textarea></th> </tr> </table> </dl> <div align="center"> <p> <input type=hidden name=BodyTag value="<body bgcolor="#484589" text="#FFFFFF" link="#FFFF00" alink="#FFFFFF" vlink="#FF7F00">"> <input type=hidden name=FA value=SendMail> </p> <p><font color="#FFFF00" face="Arial, Helvetica, sans-serif"><strong>PLEASE MAKE SURE ALL INFORMATION<br> IS CORRECT BEFORE SUBMITTING</strong></font></p> <p> <input type=submit value="Submit Form"> </p> </div> </form> THE FILE THAT PROCESSES THE FORM DATA (formdata.php) *********************************************** <?php $con = mysql_connect("localhost","XXX","XXX"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("customform", $con); $sql="INSERT INTO formdata (Fname, Lname, Title, Comp, Addr, City, SProv, Ctry, ZPC, Tel, Fax, Email, EAV, Appl, Syst, Pres, Pind, Sres, Sind, POC, Egy, Volt, TPC, CPP, Mess) VALUES ('$_POST[Fname]','$_POST[Lname]','$_POST[Title]','$_POST[Comp]','$_POST[Addr]','$_POST[City]','$_POST[SProv]','$_POST[Ctry]','$_POST[ZPC]','$_POST[Tel]','$_POST[Fax]','$_POST[Email]','$_POST[EAV]','$_POST[Appl]','$_POST[Syst]','$_POST[Pres]','$_POST[Pind]','$_POST[Sres]','$_POST[Sind]','$_POST[POC]','$_POST[Egy]','$_POST[Volt]','$_POST[TPC]','$_POST[CPP]','$_POST[Mess]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Your Information Was Successfully Posted"; mysql_close($con); $to = "recipient email address here"; $subject = "Custom Form"; $email = $_POST['Email'] ; $message = $_POST['Comp'] ; $headers = "From: $Email"; $sent = mail($to, $subject, $message, $headers) ; if($sent) {print "Your mail was sent successfully"; } else {print "We encountered an error sending your mail"; } ?> Hi everyone! I just setup a PHP Email form on my site, but everytime I submit the form with the data, nothing reaches my email! View the webpage at http://www.anywhereccw.com/regis.html . Also, can someone help me make sure all of the data inputted is captured in the email? And both regis.html & FormToEmail.php are in the same root directory! THANKS! Mike Hello my great PHP gurus, I have a question that might be simple for some of you geniuses. I have simple HTML email form getting sent by a PHP script and I cant get it to work right. All I want is the get the email, name, subject and in the body I need to have 3 variables ( name (again) Telephone and details. This is the code I have so far: HTML Form (relevant details only): <input type="text" name="name" id="name" class="input" /> <input type="text" name="subject" id="subject" class="input" /> <input type="text" name="email" id="customer_mail" class="input" /> <input type="text" name="telephone" id="telephone" class="input" /> <textarea name="detail" cols="10" rows="10" id="detail"></textarea> The PHP script is: <?php // Contact subject $subject ="$subject"; // Details $message="$detail"; // Name $name="$name"; // Mail of sender $mail_from="$customer_mail"; // From $header="from: $name <$mail_from>"; // Enter your email address $to ='onzeon@me.com'; $send_contact=mail($to,$subject,$message,$header); // Check, if message sent to your email // display message "We've recived your information" if($send_contact){ echo "We received you message, thank you"; } else { echo "ERRO"; } ?> I also tried this (with no success): <?php // Contact subject $subject ="$assunto"; // Details $body = $name; $body .= "/n"; $body .= "Telephone : ".$telephone."/n"; $body .= "Subject : ".$subject."/n"; $body .= "Details : ".$details; // Name $name="$name"; // Mail of sender $mail_from="$customer_mail"; // From $header="from: $name <$mail_from>"; // Enter your email address $to ='onzeon@me.com'; $send_contact=mail($to,$subject,$header,$body); // Check, if message sent to your email // display message "We've recived your information" if($send_contact){ echo "We received you message, thank you"; } else { echo "ERRO"; } ?> CAN ANYONE HELP, PLEASE.. Thank you very much. Cleve. I have taken a realy simple email form from w3c site and it's just not working for me at all Please help me with this. I'm using this little PHP program to collect some information and get them emailed to me...everything is working but no messages in the body. The email comes to me but nothing in the body. I'm supposed to get the name, email, phone # and how soon but I receive a blank email. I have the script posted on celebritynosejobs.net if you would like to see it! Hi, Im sort of new to PHP. I currently have this code Code: [Select] if(!empty($myrow['email'])){ echo "<a href=\"mailto: ".$myrow['email']."\">".$myrow['email']; echo "</a><br>";}Which just displays a email from the database and when clicked opens Outlook or some other email program. What i'm trying to do is hide the email and in its place put a link like "Contact" or a simple form that would send a email from my website to that email address. Does any one know any links to tutorials or at least a name for a script that would allow me to do this? Cheers! Ok I have two separate issues. The first is that I want to format the email so that the titles of the form areas are bolded (i.e., Name: Title:, etc...) the second issue is that I don't want the email to contain the blank fields (I.e. witness 2 etc.. if left empty) any help is appreciated here is my code Code: [Select] <p class="style2"><span class="style5"><strong>Incident / Unusual Occurrence Report</strong></span><br> Danville Area Community College<br><br> REPORT FORM</p> <table width="481" height="657" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td rowspan="2" valign="top" bgcolor="#FFFFFF" style="width: 481px"> <p align="center"class="style3"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <?php $problems = array(); $showform = 0; $errorMessage = ""; function validate($field, $value) { // || $field == "id" || $field == "phone" || $field == "course" || $field == "instructor" /*if ($field == "name" || $field == "email" || $field == "computers" || $field == "info") {*/ if ($value == "") { return 0; } else { return 1; } /*}*/ /*if ($field == "system" || $field == "browser" || $field == "issue" || $field == "multiple") { if ($value == "----" || $value == "") { return 0; } else { return 1; } }*/ } if($_POST) { //'id','phone','course','instructor', $fields = array('name','title', 'date', 'time', 'building', 'room', 'location', 'person', 'title1', 'phone1', 'explanation', 'security', 'police', 'witness', 'acttaken', 'followact'); $x = 0 - 1; foreach($fields as $field) { if(isset($_POST[$field])) { $validation = validate($field, $_POST[$field]); if ($validation == 1) { $x++; $info[$x] = $_POST[$field]; } else { $problems[$field] = 1; $showform = 1; } } else { $problems[$field] = 1; $showform = 1; } } } else { $showform = 1; } if(count($problems) < 1 && $_POST) { // DO THE MAILING HERE $fields = array('title', 'name','date', 'time', 'building', 'room', 'location', 'title1','person', 'phone1', 'title2', 'person2', 'phone2','title3','person3', 'phone3','title4','person4', 'phone4', 'type1', 'type2', 'type3', 'type4', 'type5', 'type6', 'type7', 'type8', 'type9', 'explanation', 'security', 'police', 'witness','wtitle1', 'wperson', 'wphone1', 'wtitle2', 'wperson2', 'wphone2','wtitle3','wperson3', 'wphone3', 'acttaken', 'followact'); $to = "ampeck@earthlink.net"; $to2 = "aabdelzaher@dacc.edu"; $subject = "Incident / Unusual Occurrence Report"; $headers = "From: noreply@dacc.edu\r\n" . "X-Mailer: php"; $greet = "The following was submitted on " . date("F j, Y, g:i a") . "\n\n"; $body = $greet ; $cn = 1; foreach($fields as $efield) { if(isset($_POST[$efield])) { if($efield == "type1" || $efield == "type2" || $efield == "type3" || $efield == "type4" || $efield == "type5" || $efield == "type6" || $efield == "type7" || $efield == "type8" || $efield == "type9" ) { $body.= "Type of Occurrence:" . $_POST[$efield] . "\n\n"; $cn++; } elseif($efield == "title") { $body.= "Name of Person Filing Report: " . $_POST[$efield] . " "; } elseif($efield == "name") { $body.= " " . $_POST[$efield] . "\n________________________________________\n\n"; } elseif($efield == "date") { $body.= "Date of Occurrence: " . $_POST[$efield] . " \t "; } elseif ($efield == "time") { $body.= "Time: " . $_POST[$efield] . "\n________________________________________\n\n"; } elseif ($efield == "building") { $body.= "Building: " . $_POST[$efield] . " \t\t "; } elseif ($efield == "room") { $body.= "Room: " . $_POST[$efield] . "\n\n"; } elseif ($efield == "location") { $body.= "Description of Location: " . $_POST[$efield] . "\t\r\n________________________________________\n\n"; } elseif ($efield == "title1") { $body.= "First Person involved: " . $_POST[$efield] . " "; } elseif ($efield == "person") { $body.= " \t" . $_POST[$efield] . "\n"; } elseif ($efield == "phone1") { $body.= "Phone : " . $_POST[$efield] . "\n________________________________________\n\n"; }elseif ($efield == "title2") { $body.= "Second Person involved: " . $_POST[$efield] . " "; } elseif ($efield == "person2") { $body.= " " . $_POST[$efield] . "\n"; } elseif ($efield == "phone2") { $body.= "Phone : " . $_POST[$efield] . "\n________________________________________\n\n"; } elseif ($efield == "title3") { $body.= "Third Person involved: " . $_POST[$efield] . " "; } elseif ($efield == "person3") { $body.= " " . $_POST[$efield] . "\n"; } elseif ($efield == "phone3") { $body.= "Phone: " . $_POST[$efield] . "\n________________________________________\n\n"; } elseif ($efield == "title4") { $body.= "Fourth Person Involved: " . $_POST[$efield] . " "; } elseif ($efield == "person4") { $body.= " " . $_POST[$efield] . " \n"; } elseif ($efield == "phone4") { $body.= "Phone: " . $_POST[$efield] . "\n________________________________________\n\n"; } elseif ($efield == "explanation") { $body.= "Detailed Explanation: " . $_POST[$efield] . "\t\r\n________________________________________\n\n"; } elseif ($efield == "security") { $body.= "Security called: " . $_POST[$efield] . "\n\n"; } elseif ($efield == "police") { $body.= "Police called: " . $_POST[$efield] . "\n\n"; } elseif ($efield == "witness") { $body.= "Were there witnesses: " . $_POST[$efield] . "\n________________________________________\n\n"; } elseif($efield == "wtitle1") { $body.= "Witness: " . $_POST[$efield] . " "; } elseif ($efield == "wperson") { $body.= " \t" . $_POST[$efield] . "\n"; } elseif ($efield == "wphone1") { $body.= "Phone : " . $_POST[$efield] . "\n________________________________________\n\n"; }elseif ($efield == "wtitle2") { $body.= "Second witness: " . $_POST[$efield] . " "; } elseif ($efield == "wperson2") { $body.= " " . $_POST[$efield] . "\n"; } elseif ($efield == "wphone2") { $body.= "Phone : " . $_POST[$efield] . "\n________________________________________\n\n"; } elseif ($efield == "wtitle3") { $body.= "Third witness: " . $_POST[$efield] . " "; } elseif ($efield == "wperson3") { $body.= " " . $_POST[$efield] . "\n"; } elseif ($efield == "wphone3") { $body.= "Phone: " . $_POST[$efield] . "\n________________________________________\n\n"; } elseif ($efield == "acttaken") { $body.= "Immediate Action Taken: " . $_POST[$efield] . "\t\r\n________________________________________\n\n"; } elseif ($efield == "followact") { $body.= "What Follow-up Action will be taken: " . $_POST[$efield] . "\t\r\n________________________________________\n\n"; } } } mail($to, $subject, $body, $headers); mail($to2, $subject, $body, $headers); ?> <p class="style1">Your report has been submitted.<br><br></p> <?php } if($showform == 1) { ?> <?php if(count($problems) > 0) { ?> <p><strong><font color="red">PLEASE CORRECT ANY FIELDS WITH A RED * BY THEM</font></strong></p> <?php } ?> <form action="" method="post"> <fieldset> <legend> <span lang="en-us">Incident Report</span> </legend> <div class="style6"> <div class="style7"> <br> <table style="width: 100%"> <tr> <td style="width: 248px" class="style1"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <label class="formtext" for="name">Name(s): <?php if(isset($problems['name'])) {?><font color="red">*</font><?php } ?></label><br> <input class="inputstyle" type="text" name="name" value="<?php if(isset($_POST['name'])){ print($_POST['name']); }?>" style=" width: 288px"></font></td> <td style="width: 148px" class="style1"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <label class="formtext" for="title">Title: <?php if(isset($problems['title'])) {?><font color="red">*</font><?php } ?></label><br> <input class="style6" type="text" name="title" value="<?php if(isset($_POST['title'])){ print($_POST['title']); }?>" style=" width: 132px"></font></td> </tr> </table><p></p> <table > <tr> <td style="width: 132px"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <label class="formtext" for="date">Date of Occurrence: <?php if(isset($problems['date'])) {?><font color="red">*</font><?php } ?></label><br> <input class="inputstyle" type="text" name="date" value="<?php if(isset($_POST['date'])){ print($_POST['date']); }?>" style=" width: 118px"></font></td> <td style="width: 170px"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <label class="formtext" for="time">Time of Occurrence: <?php if(isset($problems['time'])) {?><font color="red">*</font><?php } ?></label><br> <input class="inputstyle" type="text" name="time" value="<?php if(isset($_POST['time'])){ print($_POST['time']); }?>" style=" width: 88px"></font></td> <td style="width: 111px"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <label class="formtext" for="building">Building: <?php if(isset($problems['building'])) {?><font color="red">*</font><?php } ?></label><br> <input class="inputstyle" type="text" name="building" value="<?php if(isset($_POST['building'])){ print($_POST['building']); }?>" style=" width: 110px"></font></td> <td style="width:100px"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <label class="formtext" for="room">Room: <?php if(isset($problems['room'])) {?><font color="red">*</font><?php } ?></label><br> <input class="inputstyle" type="text" name="room" value="<?php if(isset($_POST['room'])){ print($_POST['room']); }?>" style=" width: 60px"></font></td> </tr> </table> <table style="width: 100%; height: 72px;"> <tr> <td class="style1"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <label class="formtext" for="location">Location Description: <?php if(isset($problems['location'])) {?><font color="red">*</font><?php } ?></label><br> <textarea name="location" style=" width: 383px; height: 115px;" ></textarea></font><br></td> </tr> </table> <br> <p class="style5">Person (s) involved in incident</p> <table > <tr> <td style="width: 200px"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <span lang="en-us"> <label class="formtext" for="person">Name:<?php if(isset($problems['person'])) {?><font color="red">*</font><?php } ?></label></span><br> <input class="inputstyle" type="text" name="person" value="<?php if(isset($_POST['person'])){ print($_POST['person']); }?>" style="width: 249px"></font></td> <td style="width: 114px"><label class="formtext" for="title1"> <span lang="en-us">Title</span>:</label><br> <font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <input class="inputstyle" type="text" name="title1" value="<?php if(isset($_POST['title1'])){ print($_POST['title1']); }?>" style=" width: 100px"></font></td> <td style="width: 104px"><label class="formtext" for="phone1"> <span lang="en-us">Phone</span>:</label><br> <input class="inputstyle" type="text" name="phone1" value="<?php if(isset($_POST['phone1'])){ print($_POST['phone1']); }?>" style="width: 75px"></td> </tr> <tr> <td style="width: 224px"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <input type="text" name="person2" value="<?php if(isset($_POST['person2'])){ print($_POST['person2']); }?>" style="width: 249px" style="width: 249px"></font></td> <td style="width: 114px"> <input class="inputstyle" type="text" name="title2" value="<?php if(isset($_POST['title2'])){ print($_POST['title2']); }?>" style="width: 100px"></td> <td style="width: 104px"> <input class="inputstyle" type="text" name="phone2" value="<?php if(isset($_POST['phone3'])){ print($_POST['phone3']); }?>" style="width: 75px"></td></tr> <tr> <td style="width: 224px; height: 26px;"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <input class="inputstyle" type="text" name="person3" value="<?php if(isset($_POST['person3'])){ print($_POST['person3']); }?>" style="width: 252px"></font></td> <td style="width: 114px; height: 26px;"> <input class="inputstyle" type="text" name="title3" value="<?php if(isset($_POST['title3'])){ print($_POST['title3']); }?>" style=" width: 100px"></td> <td style="width: 104px"> <input class="inputstyle" type="text" name="phone3" value="<?php if(isset($_POST['phone3'])){ print($_POST['phone3']); }?>" style=" width: 75px"></td></tr> <tr> <td style="width: 224px"> <input class="inputstyle" type="text" name="person4" value="<?php if(isset($_POST['person4'])){ print($_POST['person4']); }?>" style=" width: 252px"></td> <td style="width: 114px; height: 26px;"> <input class="inputstyle" type="text" name="title4" value="<?php if(isset($_POST['title4'])){ print($_POST['title4']); }?>" style=" width: 100px"></td> <td style="width: 104px"> <input class="inputstyle" type="text" name="phone4" value="<?php if(isset($_POST['phone4'])){ print($_POST['phone4']); }?>" style=" width: 75px"></td></tr> </table><fieldset> <legend> Please Select at least one: </legend> <p class="style5">Type of Alleged Occurrence:</p> <font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <table style="width: 100%"> <tr> <td style="width: 33%; height: 57px;"><input class="inputstyle" type="checkbox" name="type1" value="Disgruntled Action"><label class="formtext" for="type1">Disgruntled Action</label><br></td> <td style="width: 33%; height: 57px;"> <input class="inputstyle" type="checkbox" name="type2" value="Obscene Language"><label class="formtext" for="type2">Obscene Language</label><br></td> <td style="width: 33%; height: 57px;"><input class="inputstyle" type="checkbox" name="type3" value="Verbal Threats"><label class="formtext" for="type3">Verbal Threats</label><br></td> </tr> <tr> <td style="width: 33%; height: 57px;"><input class="inputstyle" type="checkbox" name="type4" value="Physical Threats"><label class="formtext" for="type4">Physical Threats<br></label><br></td> <td style="width: 33%; height: 57px;"><input class="inputstyle" type="checkbox" name="type5" value="Inappropriate Physical Behavior"><label class="formtext" for="type5">Inappropriate Physical <span lang="en-us"> </span>Behavior</label><br></td> <td style="width: 33%; height: 57px;"><input class="inputstyle" type="checkbox" name="type6" value="Written Threat"><label class="formtext" for="type6">Written Threat<br></label></td> </tr> <tr> <td style="width: 33%; height: 57px;"><input class="inputstyle" type="checkbox" name="type7" value="Sexual Offense"><label class="formtext" for="type7">Sexual Offense<br></label></td> <td style="width: 33%; height: 57px;"><input class="inputstyle" type="checkbox" name="type8" value="Robbery or Other Crime"><label class="formtext" for="type8">Robbery or Other <span lang="en-us"> <br> </span>Crimes</label><br></td> <td style="width: 33%; height: 57px;" class="style6"><input class="inputstyle" type="checkbox" name="type9" value="Other"><label class="formtext" for="type9">Other</label><br> <br> </td></div> </tr> </table><p></p> </font><table style="width: 100%; height: 72px;"> <tr> <td class="style1"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <label class="formtext" for="explanation">Detailed Explanation: <?php if(isset($problems['explanation'])) {?><font color="red">*</font><?php } ?></label><br> <textarea name="explanation" style=" width: 450px; height: 220px;" ></textarea></font><br></td> </tr> </table> </fieldset><br><br> <br> <fieldset> <legend> Actions Taken: </legend> <div class="style7"> <br> <label class="formtext" for="security"><?php if(isset($problems['security'])) {?><font color="red">*</font><?php } ?>Was Security Notified:</label> <select name="security" class="dropdownstyle"> <option value="">--Choose one--</option> <option value="Yes">Yes</option> <option value="No">No</option></select><br><br> <label class="formtext" for="police"><?php if(isset($problems['police'])) {?><font color="red">*</font><?php } ?>Were Police Notified:</label> <select name="police" class="dropdownstyle"> <option value="">--Choose one--</option> <option value="Yes">Yes</option> <option value="No">No</option></select><br><br> <label class="formtext" for="witness"><?php if(isset($problems['witness'])) {?><font color="red">*</font><?php } ?>Were there Witnesses?<br> (if yes, list names of witnesses):<span lang="en-us"> </span></label> <select name="witness" class="dropdownstyle"> <option value="">--Choose one--</option> <option value="Yes">Yes</option> <option value="No">No</option></select><br> <p class="style5">Witnesses to the Incident:</p> <table > <tr> <td style="width: 200px"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <span lang="en-us"> <label class="formtext" for="wperson">Name:</label></span><br> <input class="inputstyle" type="text" name="wperson" value="<?php if(isset($_POST['wperson'])){ print($_POST['wperson']); }?>" style="width: 249px"></font></td> <td style="width: 114px"><label class="formtext" for="wtitle1"> <span lang="en-us">Title</span>:</label><br> <font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <input class="inputstyle" type="text" name="wtitle1" value="<?php if(isset($_POST['wtitle1'])){ print($_POST['wtitle1']); }?>" style=" width: 100px"></font></td> <td style="width: 104px"><label class="formtext" for="wphone1"> <span lang="en-us">Phone</span>:</label><br> <input class="inputstyle" type="text" name="wphone1" value="<?php if(isset($_POST['wphone1'])){ print($_POST['wphone1']); }?>" style="width: 75px"></td> </tr> <tr> <td style="width: 224px"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <input type="text" name="wperson2" value="<?php if(isset($_POST['wperson2'])){ print($_POST['wperson2']); }?>" style="width: 249px; width : 249px"></font></td> <td style="width: 114px"> <input class="inputstyle" type="text" name="wtitle2" value="<?php if(isset($_POST['wtitle2'])){ print($_POST['wtitle2']); }?>" style="width: 100px"></td> <td style="width: 104px"> <input class="inputstyle" type="text" name="wphone2" value="<?php if(isset($_POST['wphone3'])){ print($_POST['wphone3']); }?>" style="width: 75px"></td></tr> <tr> <td style="width: 224px; height: 26px;"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <input class="inputstyle" type="text" name="wperson3" value="<?php if(isset($_POST['wperson3'])){ print($_POST['wperson3']); }?>" style="width: 252px"></font></td> <td style="width: 114px; height: 26px;"> <input class="inputstyle" type="text" name="wtitle3" value="<?php if(isset($_POST['wtitle3'])){ print($_POST['wtitle3']); }?>" style=" width: 100px"></td> <td style="width: 104px"> <input class="inputstyle" type="text" name="wphone3" value="<?php if(isset($_POST['wphone3'])){ print($_POST['wphone3']); }?>" style=" width: 75px"></td></tr> </table></div></fieldset> <br><br><table style="width: 100%; height: 72px;"> <tr> <td class="style1"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <label class="formtext" for="acttaken">Immediate Action Taken: <?php if(isset($problems['acttaken'])) {?><font color="red">*</font><?php } ?></label><br> <textarea name="acttaken" style=" width: 450px; height: 220px;" ></textarea></font><br></td> </tr> </table> <br><br> <table style="width: 100%; height: 72px;"> <tr> <td class="style1"><font size="-1" face="Arial, Helvetica, sans-serif" align="left"> <label class="formtext" for="followact">Follow-up Action Taken: <?php if(isset($problems['followact'])) {?><font color="red">*</font><?php } ?></label><br> <textarea name="followact" style=" width: 450px; height: 220px;" ></textarea></font><br></td> </tr> </table> I'm trying to code my first php contact form from a tutorial I found and I have it working fine except Im not receiving the information from all the fields. Im having trouble adding the fields at the end of the code. Could somebody please help me out and tell me how to add the name and phone fields into the script. Many Thanks Shane. < ?php $name = $_REQUEST['name'] ; $email = $_REQUEST['email'] ; $phone = $_REQUEST['phone'] ; $message = $_REQUEST['message'] ; if (!isset($_REQUEST['email'])) { header( "Location: http://www.jlcustombikes.com" ); } elseif (empty($name) || empty($email) || empty($phone) || empty($message)) { header( "Expires: Mon, 20 Dec 1998 01:00:00 GMT" ); header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" ); header( "Cache-Control: no-cache, must-revalidate" ); header( "Pragma: no-cache" ); ?> <html> <head><title>Error</title></head> <body> <h1>Error</h1> <p> Oops, it appears you forgot to enter either your email address or your message. Please press the BACK button in your browser and try again. </p> </body> </html> <?php } else { mail( "shngarland@gmail.com", "Feedback Form Results", $message, "From: $email" ); header( "Location: http://www.jlcustomb....com/thanks.php" ); } ?> Hi, My contact form is not sending all content. Specifically, the dates for 'birthday' and 'anniversary' is not coming through correctly. The day works fine, but the month and year is not working. This is the code I am using above head <?php //If the form is submitted if(isset($_POST['submit'])) { //Check to make sure that the name field is not empty if(trim($_POST['contactname']) == '') { $hasError = true; } else { $name = trim($_POST['contactname']); } //Check to make sure sure that a valid email address is submitted if(trim($_POST['email']) == '') { $hasError = true; } else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) { $hasError = true; } else { $email = trim($_POST['email']); } //Check to make sure that the subject field is not empty if(trim($_POST['birthday']) == '') { $hasError = true; } else { $birthday = trim($_POST['']); } //Check to make sure comments were entered if(trim($_POST['anniversary']) == '') { $hasError = true; } else { $anniversary = trim($_POST['anniversary']); } //If there is no error, send the email if(!isset($hasError)) { $emailTo = 'info@mywebsite.co.uk'; //Put your own email address here $body = "Name: $name \n\nEmail: $email \n\nBirthday: $birthday \n\nAnniversary: $anniversary"; $headers = 'From: http://www.mywebsite.co.uk <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email; mail($emailTo, $subject, $body, $headers); $emailSent = true; } } ?> This is what I am using in the body <?php if(isset($hasError)) { //If errors are found ?> <p class="error">Please check if you've filled all the fields with valid information. Thank you.</p> <?php } ?> <?php if(isset($emailSent) && $emailSent == true) { //If email is sent ?> <p><strong>Email Successfully Sent!</strong></p> <p>Thank you <strong><?php echo $name;?></strong> for using my contacting mywebsiteco.uk Your email was successfully sent. We will be in touch with you soon.</p> <?php } ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" id="contactform"> <div> <label for="name"><strong>Name:</strong></label> <input type="text" size="50" name="contactname" id="contactname" value="" class="required" /> </div> <div> <label for="email"><strong>Email:</strong></label> <input type="text" size="50" name="email" id="email" value="" class="required email" /> </div> <div> <p><label for="birthday"><strong>Birthday:</strong></label> <select name="birthday" id="birthday"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select> <select name="b_month" id="b_month"> <option value="1">January</option> <option value="2">February</option> <option value="3">March</option> <option value="4">April</option> <option value="5">May</option> <option value="6">June</option> <option value="7">July</option> <option value="8">August</option> <option value="9">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> </select> </p> </div> <div> <label for="anniversary"><strong>Anniversary:</strong></label> <select name="anniversary" id="anniversary"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select> <select name="anni_month" id="anni_month"> <option value="1">January</option> <option value="2">February</option> <option value="3">March</option> <option value="4">April</option> <option value="5">May</option> <option value="6">June</option> <option value="7">July</option> <option value="8">August</option> <option value="9">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> </select> <select name="anni_year" id="anni_year"> <option value="1979">1979</option> <option value="1980">1980</option> <option value="1981">1981</option> <option value="1982">1982</option> <option value="1983">1983</option> <option value="1984">1984</option> <option value="1985">1985</option> <option value="1986">1986</option> <option value="1987">1987</option> <option value="1988">1988</option> <option value="1989">1989</option> <option value="1990">1990</option> <option value="1991">1991</option> <option value="1992">1992</option> <option value="1993">1993</option> <option value="1994">1994</option> <option value="1995">1995</option> <option value="1996">1996</option> <option value="1997">1997</option> <option value="1998">1998</option> <option value="1999">1999</option> <option value="2000">2000</option> <option value="2001">2001</option> <option value="2002">2002</option> <option value="2003">2003</option> <option value="2004">2004</option> <option value="2005">2005</option> <option value="2006">2006</option> <option value="2007">2007</option> <option value="2008">2008</option> <option value="2009">2009</option> </select> </div> <input type="submit" value="Send Message" name="submit" link="#"/> </form> Please help. Thanks I can get "Name" etc to show on the email but not the value. eg: Name: What I need is Name: Joe Smith Here is the code: <?php if($_POST["submit"]) { $recipient="my@email.address"; $subject="Form to email message"; $sender=$cemail; $mailBody="Customers Business Name: $cbname\n $cname=Customers Name: $cname\n $caddress=Customers Address: $caddress\n $csuburb=Customers Suburb: $csuburb\n $ccity=Customers City: $ccity\n $cphone=Customers Phone Number: $cphone\n $cemail=Customers Email: $cemail\n\n $sbname=Senders Business Name: $sbname\n $sname=Senders Name: $sname\n $saddress=Senders Address: $saddress\n $ssuburb=Senders Suburb: $ssuburb\n $scity=Senders City: $scity\n $sphone=Senders Phone Number: $sphone\n\n $rbname=Receivers Business Name: $rbname\n $rname=Receivers Name: $rname\n $raddress=Receivers Address: $raddress\n $rsuburb=Receivers Suburb: $rsuburb\n $rcity=Receivers City: $rcity\n $rphone=Receivers Phone Number: $rphone\n\n $item=Item: $item\n $length=Length: $length\n $width=Width: $width\n $height=height: \n\n $message=Additional Information: "$message; mail($recipient, $subject, $mailBody, "From: $sender <$cemail>"); header('Location: thanks.php'); } ?> Here is the form <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Contact form to email</title> </head> <body> <form method="post" action="action.php"> <label>Customers Business Name:</label> <input name="cbname"><br> <label>Customers Name:</label> <input name="cname"><br> <label>Cusotmers Address:</label> <input name="caddress"><br> <label>Customers Suburb:</label> <input name="csuburb"><br> <label>Customers City:</label> <input name="ccity"><br> <label>Customers Phone Number:</label> <input name="cphone"><br> <label>Customers Email:</label> <input name="cemail"><br> <label>Senders Business Name:</label> <input name="sbname"><br> <label>Senders Name:</label> <input name="sname"><br> <label>Senders Address:</label> <input name="saddress"><br> <label>Senders Suburb:</label> <input name="ssuburb"><br> <label>Senders City:</label> <input name="scity"><br> <label>Senders Phone Number:</label> <input name="sphone"><br> <label>Receivers Business Name:</label> <input name="rbname"><br> <label>Receivers Name:</label> <input name="rname"><br> <label>Receivers Address:</label> <input name="raddress"><br> <label>Receivers Suburb:</label> <input name="rsuburb"><br> <label>Receivers City:</label> <input name="rcity"><br> <label>Receivers Phone Number:</label> <input name="rphone"><br> <label>Item:</label> <input name="item"><br> <label>Length in cm:</label> <input name="length"><br> <label>Width in cm:</label> <input name="width"><br> <label>Height in cm:</label> <input name="hight"><br> <label>Weight in kg:</label> <input name="weight"><br> <label>Additional Information:</label> <textarea rows="5" cols="20" name="info"></textarea> <input type="submit" name="submit"> </form> </body> </html> Thanks for any help for can give. First I am not a developer. I am just trying to reverse engineer the existing php form. This is the test page that I have setup. http://www.absenteehomeowners.com/arrival/index-test.php Currently the form emails the form information to a specific email address. I am trying to add the function of where if the user provides an email address then the information is also sent to the user. Here are the pages that I think are involved. Im having trouble getting this form to work on my website. It all seems to work ok, however when i test it, i dont recieve any emails to my inbox. Godaddy seems to think that I am connecting to their server in the correct manner, but say that they cannot advise on customers codeing issues. I thought that somebody in this forum maybe able to give me some pointers? [<?php ini_set('sendmail_from', 'user@domain.tld'); ini_set('SMTP', 'relay-hosting.secureserver.net'); $subject = $_POST["subject"]; $message = $_POST["message"]; $from = $_POST["from"]; $name = $_POST["name"]; $phone = $_POST["phone"]; $verif_box = $_POST["verif_box"]; $subject = stripslashes($subject); $message = stripslashes($message); $from = stripslashes($from); $name = stripslashes($name); $phone = stripslashes($phone); $embody = "$name $phone $message"; if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){ mail("ed@treework.net", 'Online Form: '.$subject, $_SERVER['REMOTE_ADDR'].$embody, "From: $from"); setcookie('tntcon',''); } else if(isset($message) and $message!=""){ header("Location:".$_SERVER['HTTP_REFERER']."?subject=$subject&from=$from&message=$message&wrong_code=true"); exit; } else { echo "no variables received, this page cannot be accessed directly"; exit; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>E-Mail Sent</title> <style type="text/css"> <!-- body,td,th { font-family: Arial, Helvetica, sans-serif; font-size: 12px; } --> </style></head> <body> Email sent. Thank you.<br /> <br /> Return to <a href="/">home page</a> ? </body> </html>] dear friends , i have this html page "</head> <body> <table width="93%" border="0" align="center" cellpadding="2" cellspacing="4"> <tr> <td height="35" colspan="3" valign="top" class="heading" style="padding-top:8px; color:#448B9A; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; font-weight:bold;"><strong>Contact Us :</strong></td> </tr> <tr> <td width="36%" class="body">Your Name:</td> <td width="64%" colspan="2"> <input type="text" name="textfield3" style="width:250px; height:13px;" size="20" /></td> </tr> <tr> <td class="body">Address:</td> <td colspan="2"> <input type="text" name="textfield32" style="width:250px; height:13px;" size="20" /></td> </tr> <tr> <td class="body">City:</td> <td colspan="2"> <input type="text" name="textfield33" style="width:250px; height:13px;" size="20" /></td> </tr> <tr> <td class="body"> Country:</td> <td colspan="2"> <input type="text" name="textfield34" style="width:250px; height:13px;" size="20" /></td> </tr> <tr> <td class="body">Phone no:</td> <td colspan="2"> <input type="text" name="textfield35" style="width:250px; height:13px;" size="20" /></td> </tr> <tr> <td class="body">email Address:</td> <td colspan="2"> <input type="text" name="textfield36" style="width:250px; height:13px;" size="20" /></td> </tr> <tr> <td class="body">Comments:</td> <td colspan="2"><textarea name="textarea" rows="5" cols="" style="width:250px;"></textarea></td> </tr> <tr> <td> </td> <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="28%"> <input type="image" name="imageField2" src="/images/submit.gif" width="62" height="22" /></td> <td width="72%"> <input type="image" name="imageField3" src="/images/reset.gif" width="62" height="22" /></td> </tr> </table></td> </tr> </table> </body> </html> " how i can use this to send email to my email address John@gmail.com thru site when someone submit the form [attachment deleted by admin] Hi all, My names Mike and i am currently working on a website for my University degree but have encountered a problem when creating an email form. I have the following form below which i have created via a tutorial but it's not working i just dont recieve any emails. I would really appreciate it if someone could take a look at this for me. I must stress i am new to PHP as well. The email form just needs to state who it comes from as well as an email address and subject. code below: Code: [Select] <html> <body> <?php if (isset($_REQUEST['email'])) //if "email" is filled out, send email { //send email $email = $_REQUEST['email'] ; $subject = $_REQUEST['subject'] ; $message = $_REQUEST['message'] ; mail("mike2fast135@hotmail.com", "$subject", $message, "From:" . $email); echo "Thank you for using our mail form"; } else //if "email" is not filled out, display the form { echo "<form method='post' action='mailform.php'> Email: <input name='email' type='text' /><br /> Subject: <input name='subject' type='text' /><br /> Message:<br /> <textarea name='message' rows='15' cols='40'> </textarea><br /> <input type='submit' /> </form>"; } ?> </body> </html> Thanks for any help or guidance. Mike I have a simple form which when a person fills out will send the results to a specified email address and display a thank you page to the visitor and finally redirect to another page. Everything seems to work except the results do not get sent to the email - can anyone help? I think it might be to do with the checkboxes - how are these processed to email? Here is the Code: The Form - survey.html ---------------------------- Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1- transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> <!-- table { background-color: #9C9; } --> </style> </head> <body> <form id="form1" name="form1" method="post" action="check.php"> <table width="500" border="0" cellspacing="2" cellpadding="2"> <tr> <td><label for="name2">Name:</label></td> <td><input type="text" name="name" id="name2" /></td> </tr> <tr> <td>Continent</td> <td><p> <label> <input type="radio" name="continent" value="Asia" id="continent_0" /> Asia</label> <br /> <label> <input type="radio" name="continent" value="Europe" id="continent_1" /> Europe</label> <br /> <label> <input type="radio" name="continent" value="Africa" id="continent_2" /> Africa</label> <br /> <label> <input type="radio" name="continent" value="North America" id="continent_3" /> North America</label> <br /> <label> <input type="radio" name="continent" value="South America" id="continent_4" /> South America</label> <br /> <label> <input type="radio" name="continent" value="Antarctica" id="continent_5" /> Antarctica</label> <br /> <label> <input type="radio" name="continent" value="Australia" id="continent_6" /> Australia</label> <br /> </p></td> </tr> <tr> <td>Favourite Color</td> <td><p> <label> <input type="checkbox" name="color[]" value="Orange" id="color_0" /> Orange</label> <br /> <label> <input type="checkbox" name="color[]" value="Yellow" id="color_1" /> Yellow</label> <br /> <label> <input type="checkbox" name="color[]" value="Blue" id="color_2" /> Blue</label> <br /> <label> <input type="checkbox" name="color[]" value="Red" id="color_3" /> Red</label> <br /> <label> <input type="checkbox" name="color[]" value="Other (Please Specify)" id="color_4" /> Other (Please Specify)</label> <label for="othercolor"></label> <input type="text" name="othercolor" id="othercolor" /> <br /> </p></td> </tr> <tr> <td><label for="comments">Your Comments:</label></td> <td><textarea name="comments" id="comments" cols="45" rows="5"></textarea></td> </tr> <tr> <td><label for="submit"></label> <input type="submit" name="submit" id="submit" value="Submit" /></td> <td> </td> </tr> </table> <p> </p> </form> </body> </html> The PHP - check.php ---------------------- <?php /*Subject and Email Variables*/ $emailSubject = 'check.php'; $webMaster = 'substituteyouremailhere'; /*Gathering Data Variables*/ $name = $_POST['name']; $continent = $_POST['continent']; $color = $_POST['color']; $othercolor = $_POST['othercolor']; $comments = $_POST['comments']; $body = <<<EOD <br><hr><br> Visitors Name: $name<br> Visitors Continent: $continent<br> Visitors Favourite Color: $color<br> Other Favourite Color: $othercolor EOD; $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /* Results rendered as HTML */ $theResults = <<<EOD <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Thanks - Survey Complete</title> <meta http-equiv="refresh" content="5;URL=http://www.google.com"> </head> <body> <p>Success - Thanks for completing the Form - We will get back to you soon!</p> </body> </html> EOD; echo "$theResults"; ?> Any help would be great - thanks ;-) Hello I've got this form that keeps messing up.
You can get to the link he http://alexis-apparel.host56.com/
Attached below are all the files. I must have this done by the end of the month please help
Attached Files
index.html 7.69KB
1 downloads
html_form_send.php 4.37KB
1 downloads
upload_file.php 879bytes
0 downloads |