Preserve line breaks with htmlentities?

php

Solution

Use `nl2br()` which converts `\n` to `<br />`:

. nl2br(htmlentities($_POST['textarea'])) .

Problem

In a form that I'm building, I have `textareas` which will include a nice amount of text, with line breaks included, such as: Sentence one Sentence two I am posting this to my form by using `htmlentities`, ex: ``` . htmlentities($_POST['textarea']) . ``` This however, produces the following in the email (HTML email) that gets sent by the form: Sentence one Sentence two Is there anyway to preserve line breaks with `htmlentities`?

Original source