RE: [PHP] How can I format text in textarea?

From: Date: Tue, 30 Aug 2005 08:16:35 +0000
Subject: RE: [PHP] How can I format text in textarea?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-221567@lists.php.net to get a copy of this message
> Hi > When I enter text as more than on paragrahs in a textarea field,The text > is displayed in one solid block of text even though I have entered it in > paragraphs. > How I can to insert line breaks in the text. (The values of textarea is > stored in database and then displayed.) > > > Bushra Hi Bushra, When displaying the data stored in your db from a textarea field, use the nl2br() function. This converts newlines in the data into "<br />" html tags. You're currently not seeing the paragraph breaks because the HTML specification doesn't display newline / carriage returns when a page is rendered in a browser -- you have to specifically indicate where paragraph breaks should take place using HTML tags. Eg: echo nl2br($data_from_db_entered_via_textarea); See: http://au2.php.net/nl2br Regards, Murray --- http://www.planetthoughtful.org "Building a thoughtful planet..."

« previous php.general (#221567) next »