Any ideas why formatted text from DB, when echo-ed out in php loses its formatting, i.e. no new lines? Thanks!
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With