Jump to content


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


Formatting text retrieved from mysql database?

Recommended Posts

I have the following form which allows admins on the site to add news topics. I can retrieve the text from the database and print it where it needs to go, but the problem lies in the formatting of the text for example if a user wanted text to be on 3 lines:


instead the result is one two three. I tried just simply using <pre> but this makes the text exceed the container i have placed it in.

Any suggestions?

Share this post

Link to post
Share on other sites
Sounds like you're in need of a line break or am I missing something here?

Erm, just thought - when echo'ing the text to the browser try this:
[code]echo nl2br($variable);[/code]

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.