Re: Processing newlines in a text area field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stephen wrote:

> I have a web page with a form with a text area. I enter:
> 
> foo
> 
> 
> bar
> 
> PHP processes the POST and inserts the record into MySQL.
> 
> The database field is text.
> 
> I use PDO
> 
> For testing I have removed any processing of the text area content.
> 
> Now, no matter how many blank rows I have between foo and bar, in the
> database record, I always get a single newline character.
> 
> I am using Firefox 7.0.1.
> 
> Is this normal behaviour? I want to be able to enter more than 1 newline.
> 
> Thanks
> Stephen

You may have forgotten that HTML treats all whitespace, such as tabs,
newlines and spaces, as a space, unless you wrap the text in PRE tags.

To display a line break where your text contains EOL characters, use nl2br()



Cheers
-- 
David Robley

Hm..what's this red button fo:=/07<NO CARRIER
Today is Boomtime, the 68th day of Bureaucracy in the YOLD 3177. 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux