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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Textarea box whitespace problem 1

Status
Not open for further replies.

amirkhansemail

Programmer
Jan 22, 2007
11
CA
I have a php form in which i have a textarea box, and i insert two or more paragraphs through it in the MySQL db, which is saved just fine.

But when i retrieve and display that data it shows me big chunk of one paragraph. In other words all paragraphs are combined in one big paragraph.

Please help me how can i keep and show the data as originally entered.

Thanks in advance.
 
If you are storing it in one field and displaying it with html, that is the default. That is, if I type
Code:
This

is 
a
bunch
of
paragraphs.

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
It will display
Code:
This is a bunch of paragraphs.
because that's how html works - it compresses spaces and carriage returns.
You'll either have to add <p> (paragraph tags) via php or do something similar.

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
the normal practice is to wrap the output of textboxes in the function nl2br() before sending to the browser.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top