Buttero Posted February 4, 2007 Share Posted February 4, 2007 Hey guys! I've just got a contact script working, but when I recive the email, all the info is hard to distinguish visually. e.g: From:nameEmail:emailMessage:message It displays like that, does anyone know how to seperate them all? I tried to wrap each of them in <p> tags, but that just showed up as text in the email. Here is the code: <?php if(isset($_POST['submit'])) { $to = "lol@gmail.com"; $subject = "Contact"; $name_field = $_POST['name']; $email_field = $_POST['email']; $message = $_POST['message']; $body = "From: $name_field E-Mail: $email_field Message:\n $message"; echo "Data has been submitted to $to!"; mail($to, $subject, $body); } else { echo "blarg!"; } ?> Any help would be greatly apprichiated, Thanks Quote Link to comment Share on other sites More sharing options...
yzerman Posted February 4, 2007 Share Posted February 4, 2007 try this instead of the newline \n $body = "From: $name_field<br /> E-Mail: $email_field<br /> Message:<br /> $message"; Quote Link to comment Share on other sites More sharing options...
kickassamd Posted February 4, 2007 Share Posted February 4, 2007 <?php if(isset($_POST['submit'])) { $to = "lol@gmail.com"; $subject = "Contact"; $name_field = $_POST['name']; $email_field = $_POST['email']; $message = $_POST['message']; $body = "From: $name_field \r\n E-Mail: $email_field \r\n Message:\n $message \r\n"; echo "Data has been submitted to $to!"; mail($to, $subject, $body); } else { echo "blarg!"; } ?> Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted February 4, 2007 Share Posted February 4, 2007 or send as an html version, and use<p> and <br> and other tages for the html good luck Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.