Memon Posted January 31, 2010 Share Posted January 31, 2010 Hello All I am using a button in my script to send the email. It sends the email, but I can not set multiple lines in email body. My script is like this; $sub="Order for Item No:".$item_no; $body = $sub."./n Name: /n Tel No:"; echo "<input type='button' value='Order This Item' onClick=\"parent.location='mailto:my@emailaddress.jp?subject=$sub&body=$body'\">"; I want "Item No" , "Name" & "Tel No" in separate lines in the mail body, but it all comes in a single line. Can someone guide me. Quote Link to comment https://forums.phpfreaks.com/topic/190432-new-line-line-feed-in-php/ Share on other sites More sharing options...
mikesta707 Posted January 31, 2010 Share Posted January 31, 2010 try using \r\n instead of just \n Quote Link to comment https://forums.phpfreaks.com/topic/190432-new-line-line-feed-in-php/#findComment-1004522 Share on other sites More sharing options...
Memon Posted January 31, 2010 Author Share Posted January 31, 2010 try using \r\n instead of just \n Thanks. I hv already tried it. Whether "\n" or "\r\n", in both cases browser gives error & mailclient does not popup. When removing this part, mail comes up, but body in single line. Quote Link to comment https://forums.phpfreaks.com/topic/190432-new-line-line-feed-in-php/#findComment-1004524 Share on other sites More sharing options...
Memon Posted January 31, 2010 Author Share Posted January 31, 2010 Problem solved by using "%0A" instead of "\n" or "\r\n". Thanks all. Quote Link to comment https://forums.phpfreaks.com/topic/190432-new-line-line-feed-in-php/#findComment-1004600 Share on other sites More sharing options...
eharpaz Posted January 31, 2010 Share Posted January 31, 2010 Memon I am having the same problem on my submit information to email script. I have 4 lines of information as seen below ($name, $customer_mail, $phone, $location). how would I make those show up on seperate lines? mail( "example@gmail.com", "Contact Form Results", $emailMessage, "$name, $customer_mail, $phone, $location" ); Quote Link to comment https://forums.phpfreaks.com/topic/190432-new-line-line-feed-in-php/#findComment-1004601 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.