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!

Formatting text fetched from a table.

Status
Not open for further replies.

JamesCliff

Programmer
Feb 16, 2005
106
GB
Hi all,

Right im doing some work on a clients website. I have a home page which is populated with a text content from a mysql table. The client edits what he wants on an admin form which updates table data from the home page.

I have a php form which lets him do this. However what im woundering is howto format the text called from the table.

So far, the home.php page displays the text from the table in just rows and rows. I want it so when the client enters info into the edit form and enters a new line of space of tab, then the text is displayed like that on the home page. Because at the minute there is no format to it and it looks unorganised and untidy. You can see what i mean below:


As you can see its all just one row after another. I want it to be formatted so when the user starts a new line of tabs spaces these show up on the home.php page.

Is there a way to do this? Is it possible? Would coding have to be used on the entry form or would the database need to be altered?

Thanks alot

Jim
 
You probably want to use the function nl2br() to translate newline chars entered in the text into HTML interpreted <br /> tags.
 
Solved it m8

Used the <pre></pre> tags

Thanks all
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top