PHP - Mail Function Through Templates
I am new to php templates and I have this simple mail function that worked until I converted to template. I am trying to accomplish a successful sendMail and redirect to the same page with a success statement. The form is set to onsubmit verify input with JavaScript.
This contact page is called through a index template and is referred to as ?p=contact Here is my code. Code: [Select] $message = $_GET['usr_find']; $message .= ""; $message .= $_GET['message']; $reason = $_GET['reason']; $email = $_GET['email']; $redirect = $_GET['redirect']; $admin = "admin email address"; $bigtime = "other email"; function sendMail($reason, $email, $message, $admin, $bigtime, $headers ) { if ($reason == "feedback") { mail($admin, $reason, $message, $email); if( return true; } if ($reason == "interested") { mail($bigtime, $reason, $message, $email ); return true; } } ?> <?php function showForm(){ print <<<_HTML_ <form id="contact" enctype="text/plain" method="GET" name="contact" action="$_SERVER[PHP_SELF]" onsubmit="return validateForm()"> <input type="hidden" name="redirect" value="http://www.bigtimebordeaux.com/pgs/scrps/contact.php"> <fieldset><legend style="color: rgb(0, 0, 0)">Please use this form to Contact Us:</legend> <table class="formTable"> <tbody> <tr> <td>Your Email Address: <input size="30" name="email" type="text"></td> </tr> <tr> <td>Reason for contact: <select name="reason"> <option selected="selected" value="not_selected">-Please select one-</option> <option value="feedback">Site Feedback or Problems</option> <option value="interested">interested in Service</option> </td> </tr> <tr> <td>How did you find us: <select name="usr_find"> <option selected="selected" value="not_selected">-Please select one-</option> <option value="friend:">Reccomended by Friend</option> <option value="internetSearch:">Internet Search</option> </select> </td> </tr> <tr> <td>Your Message:<br> <textarea maxsiz="200" name="message" cols="60" rows="10" id="message"></textarea></td> </tr> <tr> <td> <input name="submit" type="submit"> </td> </tr> </tbody> </table> </fieldset> </form> _HTML_; } if (isset($_GET['submit'])) { sendMail($reason, $email, $message, $admin, $bigtime, $headers ); echo 'We have successfully recieved your mail. Thank You'; }else{ showForm(); } ?> Similar TutorialsHello Everyone I have written a simple mail function to be emailed to a certain person on submission. On submission they would also like to have attachments sent to them. I got the email being sent but I can;t get the attachments to work. I have read several different examples and tutorials and none of them work. This is my code so far without any code for file attachment <?php $project_name = $_POST['project_name']; $needed = $_POST['date_needed']; $submitted = $_POST['date_submitted']; $department = $_POST['department']; $contact = $_POST['contact_person']; $extension = $_POST['extension']; $project_type = $_POST['project_type']; $published = $_POST['date_last_published']; $description = $_POST['description']; $color = $_POST['color']; $pdf = $_POST['pdf_needed']; $web = $_POST['web_needed']; $quanity = $_POST['quanity']; $email = "mdmartiny@sc4.edu"; $subject = "SC4 Graphics Design Service Request Form"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $message = "<html><body> <table width=\"100%\" border=\"0\" cellspacing=\"5px\" > <tr><td></td> <td>Project name: $project_name</td> <td></td> <td>Date needed by: $needed</td> </tr> <tr> <tr> <td></td> <td colspan=\"3\" align=\"left\" valign=\"top\"><strong><font size=\"+1\">Submitted to graphic designer</font></strong></td></tr> <tr><td height=\"25\"></td><td>Date $submitted</td><td>Department $department</td><td></td></tr> <tr><td height=\"25\"></td><td>Contact Person $contact</td><td>Extension $extension</td><td></tr> <tr><td height=\"25\"></td><td>Type of project $project_type</td><td colspan=\"2\">Approximate date of last publication $published</td></tr> <tr><td height=\"25\"></td><td colspan=\"3\">Project description/special instructions</td> <tr><td></td>><td colspan=\"3\">$description</td></tr> <tr><td height=\"25\"></td><td>Color $color</td><td>PDF needed $pdf</td><td>Website update needed $web</td></tr> <tr><td ></td><td>Estimated print quanity $quanity</td><td></td><td></td></tr> <tr> <td colspan=\"4\" align=\"left\" valign=\"top\"><hr height=\"5\"/> <strong><font size=\"+1\">Graphics office use only</font></strong></td> </tr> <tr> <td height=\"25\" width=\"2%\"> </td> <td width=\"34%\">Print Shop Color copier</td> <td colspan=\"2\">Print Vendor_______________________________________</td> </tr> <tr> <td height=\"25\"> </td> <td><strong><font size=\"+1\">Project tracking</font></strong></td> <td> </td> <td> </td> </tr> <tr> <td height=\"25\"> </td> <td colspan=\"3\">Received by graphic designer_______________________ Date _______</td> </tr> <tr> <td height=\"25\"> </td> <td colspan=\"3\"> <table width=\"100%\" height=\"35\"> <tr> <td>Approved by executive director__________ Date_________</td><td><input type=\"checkbox\"> Revisions needed<br /><input type=\"checkbox\"> Revisions made ______ Date_______</td><tr> </table> </td> </tr> <tr> <td height=\"25\"> </td> <td colspan=\"3\">Completed and spell checked by graphic designer___________________________ Date__________</td> </tr> <tr> <td> </td> <td align=\"center\" colspan=\"3\"> <table cellpadding=\"10px\" cellspacing=\"0\" border=\"1\" width=\"100%\"> <tr bgcolor=\"#CCCCCC\"> <td> <table> <tr> <td> Proofread by marketing coordinator __________ Date__________</td> </tr> <tr> <td> Proofread by secretary __________ Date__________ </td> </tr> </table> </td> <td> <input type=\"checkbox\"> Revisions needed <br> <input type=\"checkbox\"> Revisions made ____ Date_____ </td> </tr> </table></td> </tr> <tr> <td></td> <td colspan=\"3\"> <table width=\"100%\" height=\"75\"> <tr> <td>Proofread by executive director______ Date______ </td><td><input type=\"checkbox\"> Revisions needed<br /> <input type=\"checkbox\"> Revisions made ______ Date_______</td> </tr> </table> </td> </tr> <tr> <td></td> <td colspan=\"3\"> <table width=\"100%\" height=\"75\"> <tr> <td> Approval by requesting department __________ Date_________ <br /> <strong><font size=\"-1\">(Include all paperwork when returning)</font></strong></td><td><input type=\"checkbox\"> Revisions needed<br /><input type=\"checkbox\"> Revisions made ______ Date_______</td> </tr> </table> </td> </tr> <td></td height=\"25\"> <td colspan=\"3\">Final approval by executive director _________________________________________ Date_________ </td> </tr> <tr> <td height=\"75\"></td> <td><input type=\"checkbox\"> Printed ____ Date _____</td> <td colspan=\"2\"><input type=\"checkbox\"> PDF created _____ Date _____<br /> <input type=\"checkbox\"> Website updated _____ Date _____</td> </tr> </table>"; $message .= "</body></html>"; mail($email, $subject, $message, $headers, "From: $email"); echo "The email has been sent."; ?> $to=sammieave@ave.com,samuel@ave.com; $subject = "New Event Logged"; $message = "Test"; $headers = "From: Samuel<sammieave@ave.com>;\r\n"; $headers .= "Content-Type: text/html"; mail($to,$subject,$message,$headers); I am having the above code but unfortunately the error I am getting is: Warning: mail() [function.mail]: SMTP server response: 550 Requested action not taken: mailbox unavailable or not local in C:\xampp\htdocs\CRM\support\mailer.php on line 139 I am using magento for sending mail with condition, My code: <?php class Gta_MerchantNotification_Model_Observer { public function merchantremainder($Observer) { $order = $Observer->getEvent()->getOrder(); $order_details = $order->getAllVisibleItems(); $itemData = array(); foreach ($order_details as $list) { $incrementid = $order->getIncrementId(); $sku = $list->getsku(); $name = $list->getName(); $price = $list->getPrice(); $Qty = $list->getQtyOrdered(); $extra = $order->getIncrementId(); $message = " <tr> <!-- <td>$incrementid</td> --> <td>$sku</td> <td>$name</td> <td>$price</td> <td>$Qty</td> </tr>"; $itemData[$list->getId()] = $message; } $finalMessage = " <p>Order Id : $incrementid</p> <table border='1'> <tr> <!-- <th>Id</th> --> <th>Sku</th> <th>Product name</th> <th>Price</th> <th>Qty Ordered</th> </tr>"; if (!empty($itemData)) { foreach ($itemData as $data) { $finalMessage .= $data; } $finalMessage .= "</table>"; $this->sendMail($finalMessage); } } public function sendMail($message) { $body ="$message"; $emailTemplate = Mage::getModel('core/email'); $emailTemplate->setFromName('abc'); $emailTemplate->setBody($body); $emailTemplate->setSubject("Custom Email from observer"); $emailTemplate->setType('html'); $emailTemplate->setToEmail('abc@gmail.com'); $emailTemplate->send(); } } ?>
Output :
If order placed mail send to abc@gmail.com. I want :
1) If SKU starts with 2, email should go to the mail id abc@gmail.com,
2) If SKU starts with 3, email should go to the mail id xyz@gmail.com,
3) If SKU starts with 4, email should go to the mail id qwe@gmail.com,
FYI - If an order contains 10 items email should go separately based on SKU. But an order id the same must include all the emails.
This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=321319.0 Hello there, I've come across a issue with using PHP's mail function due to the fact I've tried a assortment of different headers yet Hotmail continues to place my sent emails in the junk folder. Here is my method of emailing my clients: function Email($AccountID, $Subject, $Message) { if($this->IsValidAccount($AccountID)) { $Account = $this->AccountKeys($AccountID); $headers .= 'To: '.$Account['account_client'].' <'.$Account['account_email'].'>' . "\r\n"; $headers .= "From: X-Host <no-reply@X-Host.co.uk>\r\n"; $headers .= "Reply-To: X-Host <no-reply@X-Host.co.uk>\r\n"; $headers .= "Return-Path: no-reply@X-Host.co.uk\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $headers .= "Organization: X-Host\r\n"; echo $Account['account_email']. $Subject. $Message; return mail($Account['account_email'], $Subject, $Message, $headers); } else return InvalidAccount; } So could anybody help me out please and tell me what headers I should be using. Hi all, I'm coding an automated mailer for a dentist office. They set appointment dates through a web interface, and then this appointment is mailed to the customer via PHP's mail() function. However, some users are not receving the mail. They claim that it is not even in the junk mail folder. Is it because I'm setting or not setting certain properties in the header? Should I be setting something else? Here is my code Code: [Select] ini_set("SMTP", "mail.isp-provider.net"); $headers = 'From: Schedule Manager <schedule@address.com>' . "\r\n" . 'Reply-To: Schedule Manager <schedule@address.com>' . "\r\n" . 'Bcc: internal@address.com' . "\r\n" . 'Content-type: text/html; charset=iso-8859-1' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($customerAddress, $subject, $body, $headers); Note that customerAddress, subject, and body are all just regular normal strings. As I said, it works for most customers, but some customers do not receive the emails. I have a notification system that notifies users of new comments, inside the email I have images, some of the logo, some of different people, everything shows up fine on my computer (yahoo email), however in the iPhones email application no images show up, there are just the blue squares with the question marks in them. I'm not sure what I'm missing. Code: [Select] $from = "Kithell <notifications@kithell.com>"; $headers = "From:" . $from ."\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $subject = name($from_id, 'fl').$action; $message = '<html><body> <style>@charset "utf-8"; /* CSS Document */ .e-container { background-color: #FFF;position: relative;width: 90%;min-height:1px;margin-right: auto;margin-left: auto; } .e-container .e-m-header { padding: 2px; background-image: url(http://www.kithell.com/assets/tall-grey-header.png); background-repeat: repeat-x; border: 1px solid #CCC; background-position: bottom; display: block; text-align: center; } .e-container p { font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; color: #666; vertical-align: text-top; display: inline-block; } .e-container .e-usr-photo { display: inline-block; margin: 10px; float: left; background-color: #F4F4F4; } .e-container p a { font-weight: bold; color: #3F60A3; text-decoration: underline; padding: 0px; float: left; margin-top: 0px; margin-right: 5px; margin-bottom: 0px; margin-left: 0px; } .e-container .e-quotes { font-size: 20px; font-weight: bold; color: #999; font-family: Tahoma, Geneva, sans-serif; display: block; padding: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 75px; margin-top:10px; } .e-container .e-message { font-size: 13px; color: #333; padding: 0px; margin-top: 0px; margin-right: 10px; margin-bottom: 0px; margin-left: 10px; clear: none; display: inline; }</style> <div class="e-container"><div class="e-m-header"><img src="http://www.kithell.com/assets/kithell-logo.png" /></div><img class="e-usr-photo" src="http://www.kithell.com/'.photo($from_id, 55).'" /><br /><p><a target="_blank" href="http://www.kithell.com/#/profile&id='.$from_id.'">'.name($from_id, "fl").' </a> '.$action.'<div class="e-quotes">"<p class="e-message">'.nl2br(htmlentities(stripslashes($message))).'</p>"</div></p></div></body></html>'; mail($to,$subject,$message,$headers); How do I include .$email to the mail function. this is my current code: mail($to, $subject, "", $headers); I want do it like this; mail("me@myweb.com".$email, $subject, "", $headers); Thanks Bickey. Hi, I'm trying to do an email from a website and it won't work. It's my first time using mail function, so I'm not sure why it is not working. Please check my code <?php $name = strip_tags($_POST['name']); $email = $_POST['email']; $qst_id=strip_tags($_POST['qst_id']); //if no ajax $opt =$_POST['opt']; $s_id = $_SERVER['REMOTE_ADDR']; $to = 'test@test.com, test1@test.com'; $subject = 'Someone just voted'; $message = "Someone from the ip address ".$s_id; // Always set content-type when sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $headers .= 'From: Vote Detector <website@test.com>'. "\r\n"; if ($name!='') { $message = $message." with the name ".$name; } if ($email!='') { $message = $message." with email ".$email; } $message = $message." voted "."yes<br/>"; $message = $message."total number of people who declared their faith: ".$total_count." people<br/>"; $message = $message."with a total of ".$total_opt[0]." people saying yes"; $message = $message." and a total of ".$total_opt[1]." people saying no<br/>"; mail($to, $subject, $message, $headers); ?> Thanks in advancr It just so happens that I have never used the PHP mail() function and i believe i've hit my first major snag. So if any of you brilliant minds out there can just take a second to error check the following code id GREATLY appreciate it! The db is connected earlier and i KNOW all the vars work because the script worked before i stuck in the mail() section. //REVISE else{ $q = mysql_query("INSERT INTO account (Username, Firstname, Lastname, Email, Active, User_type, User_language, User_registration, Pass) VALUES('$username', '$firstname', '$lastname', '$email', '$active', '$type', '$language', '$today', '$password')") or die(mysql_error()); $id = mysql_query("SELECT id FROM account WHERE Username = '$username'"); $message = "Welcome to the exciting world of Star Wars Galaxies : A New Hope! Your new username is ".$username."! Please click the following link or paste it in a web browser to complete the activation process. HTTP://www.swganh.com/account_activate.php?id=".$id;//LANGINSERT $headers = "From: matt@swganh.com.com\r\n"; mail($email, 'SWG:ANH New account registration/confirmaton', $message, $headers);//LANGINSERT } The problem is that im just not getting a mail when i send it to myself... No errors, but no mail either. Thanks in advance guys! is there a way to make a mail function submit only once? so that if you go forward a page, then back, it won't resubmit? how do I make a link to the correct fpdf file that will be created.......I want to know how I can have an email sent, and then I put a link into the email which looks like: <a href="/ticket.php?eventid=' . $eventid . '">Ticket</a>. does this make sense? do I have to save the document on the server to do this? how do i alter this code so that the recipients don't see other email addresses ? <?php
foreach(array('email1','email2','email3','youremail','yourname') as $key) $_POST[$key] = strip_tags($_POST[$key]);
# This part submits a notification to you when
// Email address for copies to be sent to - change to suit
// Notification email subject text for copies
// Email body text for notifications The people the recommendation has been submitted to a
$_POST[email1] The page recommended: $_POST[refurl] "; # This function sends the email to you @mail("$emailto", $esubject, $emailtext, "From: $_POST[youremail]"); # This part is the function for sending to recipients
// Page to display after successful submission $thankyoupage = "thankyou.html"; // Subject line for the recommendation - change to suit $tsubject = "A web page recommendation from $_POST[yourname]";
// Change the text below for the email
$ttext = " $_POST[yourname], whose email address is $_POST[youremail] thought you may be interested in this web page. $_POST[refurl] $_POST[yourname] has used our Tell-a-Friend form to send you this note. We look forward to your visit! ";
# This sends the note to the addresses submitted
# After submission, the thank you page } # Nothing further can be changed. Leave the below as is
function is_secure($ar) {
function array_values_recursive($array) { ?> ok, so I have this code and I need to know how to modify it so that the strings display properly............so that it wont display $string but instead whatever value it is.........can you please help: Code: [Select] $to = "$email"; // Change this to your site admin email $from = "events@site.net"; $subject = "Complete your registration"; //Begin HTML Email Message where you need to change the activation URL inside $message = '<html> <style type="text/css"> #apDiv1 { position:absolute; left:338px; top:278px; width:311px; height:129px; z-index:1; } #apDiv2 { position:absolute; left:50px; top:207px; width:181px; height:149px; z-index:2; } #apDiv2 { text-align: center; } </style> </head> <body><div id="apDiv1"> <table width="408" border="1" cellspacing="2" cellpadding="2"> <tr> <th width="90" scope="col">Event(s):</th> <th width="298" scope="col"> $sql = mysql_query("SELECT * FROM Registration WHERE eventid=".$_GET["eventid"]." LIMIT 1"); while($row = mysql_fetch_array($sql)){ $event = $row["event"]; $startdate = $row["startdate"]; $enddate = $row["enddate"]; $description = $row["description"]; $location = $row["location"]; $subevent1 = $row["subevent1"]; $subevent2 = $row["subevent2"]; $subevent3 = $row["subevent3"]; $subevent4 = $row["subevent4"]; $subevent5 = $row["subevent5"]; $subevent6 = $row["subevent6"]; $subevent7 = $row["subevent7"]; $subevent8 = $row["subevent8"]; //this will echo the contents of each db row as they are iterated in the loop ############################# if (!empty($title1)) { echo "<br/>$title1:"; } if (!empty($title2)) { echo "<br/>$title2:" ; } if (!empty($title3)) { echo "<br/>$title3:"; } if (!empty($title4)) { echo "<br/>$title4:"; } if (!empty($title5)) { echo "<br/>$title5:"; } if (!empty($title6)) { echo "<br/>$title6:"; } if (!empty($title7)) { echo "<br/>$title7:"; } if (!empty($title8)) { echo "<br/>$title8:"; } } //etc etc </th> </tr> <tr> <th>Price:</th> <th> $total = $price1 + $price2 + $price3 = $price4 + $price5 + $price6 + $price7 + $price8 ; echo $total; </th> </tr> <tr> <th>Registrant:</th> <th><?php echo $name; ?></th> </tr> </table> </div> <div id="apDiv2"><?php echo $name; ?> <p> </p> <p> </p> <p><a href="index.php" target="_new"><strong>Troop 78 Home</strong></a></p> <p> </p> <p> </p> <p><strong><"></a></strong></p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> </div> <img name="boyscout" src="button/boyscout.jpg" width="1180" height="700" border="0" id="boyscout" alt="" /> </body> </html>'; // end of message $headers = "From: $from\r\n"; $headers .= "Content-type: text/html\r\n"; $to = "$to"; // Finally send the activation email to the member mail($to, $subject, $message, $headers); // Then print a message to the browser for the joiner print "<br /><br /><br /><h4>OK $firstname, one last step to verify your email identity:</h4><br /> We just sent an Activation link to: $email<br /><br /> <strong><font color=\"#990000\">Please check your email inbox in a moment</font></strong> to click on the Activation <br /> Link inside the message. After email activation you can log in."; $to = "@gmail.com"; // Change this to your site admin email $from = "events@site.net"; $subject = "New Registration for $event"; //Begin HTML Email Message where you need to change the activation URL inside $message = '<html> <body> Hello, Aaron $name has registered for $event. they will owe $total = $price1 + $price2 + $price3 = $price4 + $price5 + $price6 + $price7 + $price8 ; echo $total; </body> </html>'; // end of message $headers = "From: $from\r\n"; $headers .= "Content-type: text/html\r\n"; $to = "$to"; // Finally send the activation email to the member mail($to, $subject, $message, $headers); // Then print a message to the browser for the joiner print "<br /><br /><br /><h4>OK $firstname, one last step to verify your email identity:</h4><br /> We just sent an Activation link to: $email<br /><br /> <strong><font color=\"#990000\">Please check your email inbox in a moment</font></strong> to click on the Activation <br /> Link inside the message. After email activation you can log in."; Hello, I am using php to send verification links for my website.The registration form sends data to xyz.php(using AJAX) and the response(echo'd part of xyz.php) is returned and shown to the user. The problem i am facing is that the function "$mail->Send()" is echoing the smtp server response.How can i stop this function from echo'in anything. Please reply asap. I'm using the php mail function on some forms for our company website. There is reason to believe that they sometimes don't work. Is this a normal behavior for this? We've been "discussing" whether or not they work for about 2 - 3 days and in most instances they do. However we've had 1 person fill them out and then we never received the emails. I was wondering if some of the people that have worked with php for a longtime have ever had any experience with this type of thing happening. I am new to php and I have a form on my website, the form works correctly the only issue is with the variable $message it gives me all the information from the form as one long sentence and I want to break up each question as a new line, but can't seem to solve this any idea's... Code: [Select] $firstname= $_POST['firstname']; $lastname= $_POST['lastname']; $email= $_POST['email']; $from=$_POST["confirmemail"]; $phonenumber= $_POST["phonenumber"]; $message="First Name: $firstname". "Last Name: $lastname". "Email: $email". "Phone number: $phonenumber"; mail("hernandez40724@gmail.com","Tenant-Buyer Form",$message,"From: $from \n"); echo "Message Sent"; Hi Everyone, Please have a look at the code below the first set is from my contact form and the second is the function, it is a function that is passed a form variable in the form of an array and is also passed a form title variable. Everything worked fine this morning but when I checked the functionality of it a few hours ago the mail function wasn't sending, although the logic was working. I checked my spam filter and the emails weren't held up there. Code: [Select] require('../php_classes/TrueViewI.php'); include('../php_functions/functions.php'); if(isset($_POST['submit'])) { $error_message = processFormData($_POST, 'Home Inspections'); if($error_message == 'Thank you, someone will contact you shortly.') { session_unset(); } } //future $keywords = ''; //future $meta_tags = ''; //future $left_column = ''; $middle_column = '<img class="page_heading" src="../images/contactus.png" alt="True View Service Home Inspections Contact Us" /> <form method="post" action=""> <fieldset id="contactform"> <!-- <legend>Home Inspections Contact Form</legend> --> <h4>Home Inspections Contact Form</h4> <span class="errors">'.(!empty($error_message) ? $error_message : '').'</span> <div class="row_div"> <div class="label_div"> <label>First Name:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <input name="First Name" type="text" maxlength="50" size="50" value="'. (!empty($_SESSION['First_Name']) ? $_SESSION['First_Name'] : '').'" /> </div> </div> <div class="row_div"> <div class="label_div"> <label>Last Name:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <input name="Last Name" type="text" maxlength="50" size="50" value="'. (!empty($_SESSION['Last_Name']) ? $_SESSION['Last_Name'] : '').'" /> </div> </div> <div class="row_div"> <div class="label_div"> <label>Phone Number:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <input name="Phone Number" type="text" maxlength="50" size="50" value="'. (!empty($_SESSION['Phone_Number']) ? $_SESSION['Phone_Number'] : '').'" /> </div> </div> <div class="row_div"> <div class="label_div"> <label>Email Address:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <input name="Email Address" type="text" maxlength="50" size="50" value="'. (!empty($_SESSION['Email_Address']) ? $_SESSION['Email_Address'] : '').'" /> </div> </div> <div class="row_div"> <div class="label_div"> <label>Renovation Address:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <input name="Renovation Address" type="text" maxlength="50" size="50" value="'. (!empty($_SESSION['Renovation_Address']) ? $_SESSION['Renovation_Address'] : '').'" /> </div> </div> <div class="row_div"> <div class="label_div"> <label>Age of Home:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <select name="Age Of Home" class="input"> <option value="">--Choose One--</option> <option value="0-10"'. ((!empty($_SESSION['Age_Of_Home']) && ($_SESSION['Age_Of_Home'] == '0-10')) ? ' selected="selected" ' : ''). '>0 to 10 years old</option> <option value="11-20"'. ((!empty($_SESSION['Age_Of_Home']) && ($_SESSION['Age_Of_Home'] == '11-20')) ? ' selected="selected" ' : ''). '>11 to 20 years old</option> <option value="21-30"'. ((!empty($_SESSION['Age_Of_Home']) && ($_SESSION['Age_Of_Home'] == '21-30')) ? ' selected="selected" ' : ''). '>21 to 30 years old</option> <option value="31-40"'. ((!empty($_SESSION['Age_Of_Home']) && ($_SESSION['Age_Of_Home'] == '31-40')) ? ' selected="selected" ' : ''). '>31 to 40 years old</option> <option value="41-50"'. ((!empty($_SESSION['Age_Of_Home']) && ($_SESSION['Age_Of_Home'] == '41-50')) ? ' selected="selected" ' : ''). '>41 to 50 years old</option> <option value="50+"'. ((!empty($_SESSION['Age_Of_Home']) && ($_SESSION['Age_Of_Home'] == '50+')) ? ' selected="selected" ' : ''). '>More than 50 years old</option> </select> </div> </div> <div class="row_div"> <div class="label_div"> <label>Square Footage of Home:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <select name="Square Footage Of Home" class="input"> <option value="">--Choose One--</option> <option value="1000-1500"'. ((!empty($_SESSION['Square_Footage_Of_Home']) && ($_SESSION['Square_Footage_Of_Home'] == '1000-1500')) ? ' selected="selected" ' : ''). '>1000 to 1500 square feet</option> <option value="1501-2000"'. ((!empty($_SESSION['Square_Footage_Of_Home']) && ($_SESSION['Square_Footage_Of_Home'] == '1501-2000')) ? ' selected="selected" ' : ''). '>1501 to 2000 square feet</option> <option value="2001-2500"'. ((!empty($_SESSION['Square_Footage_Of_Home']) && ($_SESSION['Square_Footage_Of_Home'] == '2001-2500')) ? ' selected="selected" ' : ''). '>2001 to 2500 square feet</option> <option value="2501-3000"'. ((!empty($_SESSION['Square_Footage_Of_Home']) && ($_SESSION['Square_Footage_Of_Home'] == '2501-3000')) ? ' selected="selected" ' : ''). '>2501 to 3000 square feet</option> <option value="3000+"'. ((!empty($_SESSION['Square_Footage_Of_Home']) && ($_SESSION['Square_Footage_Of_Home'] == '3000+')) ? ' selected="selected" ' : ''). '>More than 3000 square feet</option> </select> </div> </div> <div class="row_div"> <div class="label_div"> <label>Are you buying or selling?:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <select name="Buying Or Selling" class="input"> <option value="">--Choose One--</option> <option value="Buying"'.((!empty($_SESSION['Buying_Or_Selling']) && ($_SESSION['Buying_Or_Selling'] == 'Buying')) ? ' selected="selected" ' : '').'>Buying</option> <option value="Selling"'.((!empty($_SESSION['Buying_Or_Selling']) && ($_SESSION['Buying_Or_Selling'] == 'Selling')) ? ' selected="selected" ' : '').'>Selling</option> </select> </div> </div> <div class="row_div"> <div class="label_div"> <label>Preferred Date and Time for Inspection:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <input name="Preferred Date and Time for Inspection" type="text" maxlength="50" size="50" value="'. (!empty($_SESSION['Preferred_Date_and_Time_for_Inspection']) ? $_SESSION['Preferred_Date_and_Time_for_Inspection'] : '').'" /> </div> </div> <div class="row_div"> <div class="label_div"> <label>Comments or Questions:</label> <!-- <span class="required">* </span> --> </div> <div class="input_div"> <textarea name="Comments or Questions" type="text" rows="10">'. (!empty($_SESSION['Comments_or_Questions']) ? $_SESSION['Comments_or_Questions'] : '').'</textarea> </div> </div> <div class="row_div"> <input id="button" name="submit" type="submit" value="Send Message" /> </div> </fieldset> </form>'; $contact = new TrueViewI('True View Services Inspections - Contact Us', '../css/styles.css', NULL, NULL, 7, 1, 1); $contact->setContent('middle_col_content', $middle_column); $contact->display_page(); Code: [Select] function processFormData($array, $form) { $errors = NULL; $message = NULL; foreach($array as $key => $value) { //if any of the form values are empty catch them and add to error array if(empty($value) && $key != 'submit') { //build error list $errors .= '"' . str_replace('_', ' ', $key) . '" is a required field!<br />'; } else if(!empty($value) && $key != 'submit') { //capture values and insert them into a session variable $_SESSION[$key] = $value; } } if(empty($errors)) { mail('tinwakr@bell.net', $form, str_replace('_', ' ', $message)); return 'Thank you, someone will contact you shortly.'; } else { return $errors; } } I currently use this to send mail: Code: [Select] $message = "$quote_num<BR> PU: $city1, $state1. $zip1<BR> DL: $city2, $state2. $zip2<BR> $miles Miles<BR> Qty: $quantity $freight_type<BR> Lifgate: $liftgate<BR> Weight: $weight<BR> $description<BR> Quoted Price: $total_price"; The mail goes through fine, but it shows the <BR> in the meassage. Any help is appreciated! |