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? Link to comment https://forums.phpfreaks.com/topic/133137-print-the-input-in-seperate-line/ 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 Link to comment https://forums.phpfreaks.com/topic/133137-print-the-input-in-seperate-line/#findComment-692404 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 Link to comment https://forums.phpfreaks.com/topic/133137-print-the-input-in-seperate-line/#findComment-692435 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}"); Link to comment https://forums.phpfreaks.com/topic/133137-print-the-input-in-seperate-line/#findComment-692438 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.