textarea question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
cto1mac
Forum Commoner
Posts: 54
Joined: Tue Jan 27, 2004 6:11 am
Location: Virginia Beach, VA

textarea question

Post by cto1mac »

I have a textarea in a form. When I write to the db it writes to a blob data type. But it doesn't save the formatting. Is there anything that I can do to save the formatting from the textarea? For example if someone enters a blank line by hitting enter twice I want the value entered in the db to have that blank line. As it is right now it strips out the blank line and just writes the entire value out in one long string of characters.

Thanks
EvilOne
Forum Newbie
Posts: 2
Joined: Sun Sep 05, 2004 9:49 am

Post by EvilOne »

for new row format the text using [php_man]nl2br()[/php_man] function
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

You are mistaken, the format is not lost.

But, as you should know, html ignores newlines etc...... As suggested, use [php_man]nl2br[/php_man]
User avatar
vigge89
Forum Regular
Posts: 875
Joined: Wed Jul 30, 2003 3:29 am
Location: Sweden

Post by vigge89 »

otherwise, you can use the css-attribute:

Code: Select all

white-space: pre;
makes newlines appear as newlines ;)
Post Reply