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?
Use
nl2br()which converts\nto<br />: