Jump to content


This topic is now archived and is closed to further replies.


Keeping paragraphs etc.

Recommended Posts

I am currently copying data into a database from an existing page on my site.

When the text is entered into a text area on a form it is paragraphed.  But when viewed on the page wich retrieves the data from the database it is just one continuous chunk of text.

Is there any way of keeping the paragraphs etc? (A similar format to entering a post on this site would be ideal)


Share this post

Link to post
Share on other sites
What are you using to view the data in the database?

When displaying the data back to a browser, the browser does not interpret the newline character. To be able to show the text correctly use the [url=http://www.php.net/nl2br]nl2br()[/url] function.

$text =  "this text has \nnewline\n characters in it";
echo nl2br($text);


Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.