Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retaining Text Format upon retrevial from DB

Status
Not open for further replies.

dexthageek

IS-IT--Management
Mar 23, 2002
59
US
I am working on creating a template for users to type content into a form then save it to a database. When the data is extracted from the DB and displayed on the page, all whitespace is ignored. I tried using <pre> tag which works but then you have the problem where there is no textwrapping so it throws my tables out of wack.

Can anyone tell me how to display content from a DB on a webpage and maintain the linebreaks.

Thanks in advance
Mike
 
If you just need to preserve linebreaks, your solution is definitely nl2br() function. It will convert all your regular newline characters to <br />s, which is how html marks line breaks. Just wrap this function around the variable you need to preserve line breaks in.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top