Text Area

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
sampage
Forum Newbie
Posts: 22
Joined: Sat Mar 18, 2006 6:17 pm

Text Area

Post by sampage »

I have a simple User Brief input on my website.

However, when a user enters a brief, and for example hits return a couple of times...

like that, when I display the data on a page from the database the returned lines are ignored. Displaying the data back into a textarea they are still there.

How can I get round this with-out installing complicated WYSIWYG text inputs?
User avatar
AKA Panama Jack
Forum Regular
Posts: 878
Joined: Mon Nov 14, 2005 4:21 pm

Post by AKA Panama Jack »

Use the PHP function nl2br to display the text..

Code: Select all

echo nl2br($yourtextvariable);
That will convert all new lines to <br> so it will display properly.
sampage
Forum Newbie
Posts: 22
Joined: Sat Mar 18, 2006 6:17 pm

Post by sampage »

Thank you very much
Post Reply