Cause
This is the default behavior for all user agents. If you look at the source of the page, you will see that your text has the same formatting as in the database (or in the text box).
The reason for your confusion is probably because you once saw the text in the <textarea> , which displays pre-formatted text, does not interpret the tags, and in the other case the text is interpreted (spaces are not important in this case).
No new lines are displayed in browsers unless specifically specified — using the <br> tag or block level tags.
No tags == No new lines.
Correction
If you save preformatted text in a database,
you must wrap the output in a <pre> .
You can convert formatting characters to desired HTML tags using a set of functions such as nl2br , str_replace , etc.
You can also fix your structure for storing HTML in a database instead of plain text (however, markup looks like the best solution).
See a similar question:
source share