onei0120 Posted July 7, 2009 Share Posted July 7, 2009 Okay i have figured out my email problem!! But Now when my email sends all the values are displayed in a straight line kind of like this: 20 Joe Blow 123 Fake Street 67 Faketown Fakeville etc. and i want to be able to put strings in so when the email send you will see something like this: Age: 20 First Name: Joe Last Name: Blow Address: 123 Fake Street Apt: 67 City: Faketown Province: Fakeville This is my code: <?php $to = "*******@****.com"; $subject = "Contest Entry"; $headers = "From: $Email"; $Age = $_REQUEST['age'] ; $FirstName = $_REQUEST['first_name'] ; $LastName = $_REQUEST['last_name'] ; $Address = $_REQUEST['add'] ; $Apt = $_REQUEST['apt'] ; $City = $_REQUEST['city'] ; $Prov = $_REQUEST['prov'] ; $PostalCode = $_REQUEST['postcode'] ; $Email = $_REQUEST['email'] ; $Phone = $_REQUEST['phone'] ; $Skills = $_REQUEST['skills'] ; $News = $_REQUEST['accept'] ; $message =.$Age." ".$FirstName." ".$LastName." ".$Address." ".$Apt." ".$City." ".$Prov." ".$PostalCode." ".$Email." ".$Phone." ".$Skills." ".$News; $sent = mail($to, $subject, $headers, $message); if($sent) {print "Mail Was sent sucessfully"; } else {print "We encountered an error sending your mail"; } ?> Link to comment https://forums.phpfreaks.com/topic/165014-getting-line-breaks-in-an-email/ Share on other sites More sharing options...
seventheyejosh Posted July 7, 2009 Share Posted July 7, 2009 just do like: $message="AGE: $age"; $message.="<br>"; // not <br /> i believe $message.="LOCATION: $location"; $message.="<br>"; etc etc Link to comment https://forums.phpfreaks.com/topic/165014-getting-line-breaks-in-an-email/#findComment-870172 Share on other sites More sharing options...
p2grace Posted July 7, 2009 Share Posted July 7, 2009 Put a \r\n after each line. That's the plain text version of a line break. Link to comment https://forums.phpfreaks.com/topic/165014-getting-line-breaks-in-an-email/#findComment-870173 Share on other sites More sharing options...
p2grace Posted July 7, 2009 Share Posted July 7, 2009 just do like: $message="AGE: $age"; $message.="<br>"; // not <br /> i believe $message.="LOCATION: $location"; $message.="<br>"; etc etc All breaks should be in the format <br />, because all opened tags need to be closed according to W3C standards and proper coding syntax. Link to comment https://forums.phpfreaks.com/topic/165014-getting-line-breaks-in-an-email/#findComment-870175 Share on other sites More sharing options...
seventheyejosh Posted July 7, 2009 Share Posted July 7, 2009 ya i meant it the other way around sorry! its been a long day! Link to comment https://forums.phpfreaks.com/topic/165014-getting-line-breaks-in-an-email/#findComment-870176 Share on other sites More sharing options...
PugJr Posted July 7, 2009 Share Posted July 7, 2009 just do like: $message="AGE: $age"; $message.="<br>"; // not <br /> i believe $message.="LOCATION: $location"; $message.="<br>"; etc etc All breaks should be in the format <br />, because all opened tags need to be closed according to W3C standards and proper coding syntax. That is not 100% true. Img tags (Not sure if its limited to only img tags and not everything) should be closed with > and NOT /> if you are using 4.01 or lower. Link to comment https://forums.phpfreaks.com/topic/165014-getting-line-breaks-in-an-email/#findComment-870185 Share on other sites More sharing options...
p2grace Posted July 7, 2009 Share Posted July 7, 2009 img tags are supposed to be <img src="img.jpg" alt="alt text" /> Link to comment https://forums.phpfreaks.com/topic/165014-getting-line-breaks-in-an-email/#findComment-870189 Share on other sites More sharing options...
PugJr Posted July 7, 2009 Share Posted July 7, 2009 Nope. This site says differently. http://jigsaw.w3.org/css-validator/validator?uri=phpfreaks.com&profile=css21&usermedium=all&warning=1&lang=en (close the img tag with > instead of /> if using HTML <= 4.01) Link to comment https://forums.phpfreaks.com/topic/165014-getting-line-breaks-in-an-email/#findComment-870202 Share on other sites More sharing options...
p2grace Posted July 7, 2009 Share Posted July 7, 2009 lol I love how the code they provide to show your code is W3C compliant is: <p> <a href="http://jigsaw.w3.org/css-validator/check/referer"> <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" /> </a> </p> (notice how the img tag is self-closed) Either way we shouldn't continue discussing this here as it doesn't pertain to the topic. Link to comment https://forums.phpfreaks.com/topic/165014-getting-line-breaks-in-an-email/#findComment-870204 Share on other sites More sharing options...
PugJr Posted July 7, 2009 Share Posted July 7, 2009 Duh. Thats why they had: (close the img tag with > instead of /> if using HTML <= 4.01) Incase you are running HTML <= 4.01 but of course a CSS validator is going to be up to date with everything so they will have the new code. Where do we take this then? Actually, I don't think there is much to say as not all HTML ends with /> That code is /only/ compliant with W3C under the condition its HTML > 4.01. If it was HTML <= 4.01 then it wouldn't be compliant. But you might still be right that its always supposed to be <br /> for any line breaks no matter what the HTML version. Link to comment https://forums.phpfreaks.com/topic/165014-getting-line-breaks-in-an-email/#findComment-870205 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.