Use nl2br()
.
New lines are ignored by browser. That’s why you see all text without line breaks. nl2br() converts new lines to <br />
tags that are displayed as new lines in browsers.
If you want to display your text in <textarea>
, you don’t need to convert all new lines to <br />
. Anyway, if you do it… you will see “<br />
“s as text in new lines places.