bal bal Posted November 17, 2008 Share Posted November 17, 2008 hi i am getting inputs from HTML form using PHP and those are sending to me through email. now all the inputs are printing in the same line, can anyone please help me to print them in seperate line? here is all the code. $body=$answer1.' '.$answer2.' '.$answer3; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html"; $headers .= "From: $name \r\n"; $sent=mail("{$to}", "{$subject}", "{$body}", "{$headers}"); now I need to print these answer in seperate line. can anyone please help me? Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted November 17, 2008 Share Posted November 17, 2008 its an html message as set by your header (you are missing a \r\n after the content-type header) So you can use html break tags <br /> to seperate them into lines For a simple message you can just use a text message and use \r\n to add break lines Quote Link to comment Share on other sites More sharing options...
bal bal Posted November 18, 2008 Author Share Posted November 18, 2008 thanks, but I am talking about the $body varialbe where the answers are stored, here it is called answer1 and answer2, so if the answer1 is hi and answer2 is how are you, then the result should be printed in two different lines like hi how are you instead of hi how are you Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted November 18, 2008 Share Posted November 18, 2008 I'm not going to hold your hand while type for you come on <?php $body=$answer1.'<br /> '.$answer2.'<br /> '.$answer3; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html"; $headers .= "From: $name \r\n"; $sent=mail("{$to}", "{$subject}", "{$body}", "{$headers}"); 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.