Jump to content

print the input in seperate line


bal bal

Recommended Posts

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

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

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

 

 

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}");

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.