Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Sep 2006
    Thanked 0 Times in 0 Posts

    PHP and textarea form element

    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??


  • #2
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Denver, Colorado USA
    Thanked 340 Times in 332 Posts
    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
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts