harville85 Posted August 11, 2006 Share Posted August 11, 2006 I know this is probably so simple I'm going to cry after getting the answer, but I'll ask anyway: I can make a form on my website and it works great, sends the email over like it's supposed to, but how do I make it read like this:Name: John DoeAddress: 123 st.City: DoofusState:XXInstead of this:John Doe123 st.DoofusXXI'm using PHP Mailer by the way. Any help would be appreciated!!! Link to comment https://forums.phpfreaks.com/topic/17290-stupid-email-form-question/ Share on other sites More sharing options...
sasa Posted August 11, 2006 Share Posted August 11, 2006 $body="Name: $name\nAddress: $address\n..." Link to comment https://forums.phpfreaks.com/topic/17290-stupid-email-form-question/#findComment-73387 Share on other sites More sharing options...
harville85 Posted August 11, 2006 Author Share Posted August 11, 2006 Thanks, I'll see if I can make this work. While I do that, here's an example of what I have now that works, but it doesn't list the actual category in my email.$text_body = $_POST['contact_name']. "<br>";$text_body .= $_POST['city']. "<br>";$text_body .= $_POST['state']. "<br>";$text_body .= $_POST['zip_code']. "<br>";$text_body .= $_POST['phone']. "<br>";$text_body .= $_POST['fax']. "<br>";$text_body .= $_POST['email']. "<br>"; Link to comment https://forums.phpfreaks.com/topic/17290-stupid-email-form-question/#findComment-73390 Share on other sites More sharing options...
onthespot Posted August 11, 2006 Share Posted August 11, 2006 Name: $text_body = $_POST['contact_name']. "<br>";City: $text_body .= $_POST['city']. "<br>";$text_body .= $_POST['state']. "<br>";$text_body .= $_POST['zip_code']. "<br>";$text_body .= $_POST['phone']. "<br>";$text_body .= $_POST['fax']. "<br>";$text_body .= $_POST['email']. "<br>";i think you can do that mate! Link to comment https://forums.phpfreaks.com/topic/17290-stupid-email-form-question/#findComment-73392 Share on other sites More sharing options...
harville85 Posted August 11, 2006 Author Share Posted August 11, 2006 I did what you suggested and I'm getting this when I click submit:Parse error: parse error, unexpected ':' in C:\Sites\Single26\harville85\webroot\hd_mail.php on line 31 Link to comment https://forums.phpfreaks.com/topic/17290-stupid-email-form-question/#findComment-73393 Share on other sites More sharing options...
onthespot Posted August 11, 2006 Share Posted August 11, 2006 cud u provide the full script? Link to comment https://forums.phpfreaks.com/topic/17290-stupid-email-form-question/#findComment-73395 Share on other sites More sharing options...
harville85 Posted August 11, 2006 Author Share Posted August 11, 2006 Sure, here it is:<?require("c:\php\includes\class.phpmailer.php");$mail = new PHPMailer();$mail->IsSMTP();$mail->Host = "mail.harvilledesign.com";$mail->SMTPAuth = true;$mail->Username = "[email protected]";$mail->Password = "xxxxxx";$mail->From =$_POST['email'];$mail->FromName = "HD Web Contact Form";$mail->AddAddress("[email protected]");$mail->IsHTML(true);$mail->Subject = "HD Web Contact Form";$text_body = $_POST['contact_name']. "<br>";$text_body .= $_POST['city']. "<br>";$text_body .= $_POST['state']. "<br>";$text_body .= $_POST['zip_code']. "<br>";$text_body .= $_POST['phone']. "<br>";$text_body .= $_POST['fax']. "<br>";$text_body .= $_POST['email']. "<br>";$mail->Body = $text_body;if(!$mail->Send()){echo "There was an error sending the message";exit;}header("Location:thankyou_hd.html");?> Link to comment https://forums.phpfreaks.com/topic/17290-stupid-email-form-question/#findComment-73396 Share on other sites More sharing options...
sasa Posted August 11, 2006 Share Posted August 11, 2006 [quote author=harville85 link=topic=103925.msg414219#msg414219 date=1155336416]Thanks, I'll see if I can make this work. While I do that, here's an example of what I have now that works, but it doesn't list the actual category in my email.$text_body = $_POST['contact_name']. "<br>";$text_body .= $_POST['city']. "<br>";$text_body .= $_POST['state']. "<br>";$text_body .= $_POST['zip_code']. "<br>";$text_body .= $_POST['phone']. "<br>";$text_body .= $_POST['fax']. "<br>";$text_body .= $_POST['email']. "<br>";[/quote]change in[code]$text_body = "Name: ".$_POST['contact_name']. "<br>";$text_body .= "City: ".$_POST['city']. "<br>";etc.[/code] Link to comment https://forums.phpfreaks.com/topic/17290-stupid-email-form-question/#findComment-73426 Share on other sites More sharing options...
akitchin Posted August 11, 2006 Share Posted August 11, 2006 easier still:[code]<?php$text_body = "Name: {$_POST['contact_name']}City: {$_POST['city']}etc.Last field: {$_POST['last_field']}";$message_content = nl2br($text_body);?>[/code] Link to comment https://forums.phpfreaks.com/topic/17290-stupid-email-form-question/#findComment-73429 Share on other sites More sharing options...
harville85 Posted August 12, 2006 Author Share Posted August 12, 2006 Thanks! It works! (That was pretty simple!) Link to comment https://forums.phpfreaks.com/topic/17290-stupid-email-form-question/#findComment-73448 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.