Mazen Mazen - 1 year ago 64
HTML Question

"textarea" multilines PHP/HTML

I am using php and html codes in the same file for a contact form.

When I write multiple lines in a html form (textarea):

(name="TBody" cols="100" rows="10" class="largertextarea" required="required" placeholder="Leave A Message Here"),

the php received the information and put all of them in the same line :

$body = $_POST["TBody"];
$msgbody = "- Message is about:" . "<br>" . $body;

For example :

Hope all are fine.

What I receive in email is like this :

Hi, Hope all are fine. Bye.

So, how can I put them in multiple lines?

Answer Source

When you catch your $_Post['textarename']

Use $message=nl2br($_POST["TBody"];);

Then that will save your <br> tags from textarea

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download