View Full Version : PHP and textarea form element

07-08-2007, 08:26 PM
I have a textarea in a form which has been created like this:

<textarea name="textarea" wrap=hard cols=100 rows=25></textarea>

The wrap element is declared as 'hard' meaning the text wraps in the textarea and the linebreaks are stored in the database. The field storing the content of the textarea is declasred as a 'longtext' but when the data is retrieved from the database the linebreaks arentaccounted for and a continuous string is returned.

Is this because I am using an incorrect data type to store the text or is there another error??


07-08-2007, 09:01 PM
Forms use \n for new lines. However, browsers use the <br> or <br /> tag to render a new line on a web page. See this link - http://php.net/nl2br