Activity Stream
48,167 MEMBERS
61296 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 4 of 4
  1.     
    #1
    Banned

    Default Problems showing a newline within a textarea, once grabbed info from within a db

    Basically i am having a little problem displaying a newline within a textarea. The contents of the text area are grabbed from a database, which have already previously converted all newlines to <br> tags, as i would like to use it within a html page. But i also want to offer a user the chance to edit this data via the use of a textarea. Now the problem is i would like the textarea to display the content in the same way it does on a html document, So i decided to replace <br> with \n once again, and then post the content within the <textarea>...</textarea> tags. But I seem to be getting "content with a \n instead of actually showing the newline itself". How would i overcome this??
    utomtear Reviewed by utomtear on . Problems showing a newline within a textarea, once grabbed info from within a db Basically i am having a little problem displaying a newline within a textarea. The contents of the text area are grabbed from a database, which have already previously converted all newlines to <br> tags, as i would like to use it within a html page. But i also want to offer a user the chance to edit this data via the use of a textarea. Now the problem is i would like the textarea to display the content in the same way it does on a html document, So i decided to replace <br> with \n once Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Member
    it's php, right?
    maybe you have to change 'single quotes' to "double quotes" around that \n?

  4.     
    #3
    The Wise One
    Website's:
    twilight.ws ddlrank.com

  5.     
    #4
    Member
    Website's:
    epicimagehost.com
    As deliteblogger said, be sure to use double quotes for your newline.

    PHP Code: 
    <?php
    $newline 
    "\n";
    $text 'Hello world';

    echo 
    '<textarea>';

    echo 
    $text $newline// -> Hello world + newline
    echo $text "\n"// -> Hello world + newline
    echo 'Hello World' "\n"// -> Hello world + newline

    echo '</textarea>';
    ?>
    Those three ways will work.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Installed WP is not showing !
    By shufol in forum Wordpress
    Replies: 7
    Last Post: 12th Nov 2012, 03:18 PM
  2. [Selling] creepy-video.info,online-stalker.info,scary-vid.info
    By Porsche_maniak in forum Completed Transactions
    Replies: 0
    Last Post: 12th May 2012, 08:46 AM
  3. [Selling] TwitterMoney.info, TopBetting.info, Watch-Shows.info (domains)
    By min123 in forum Completed Transactions
    Replies: 0
    Last Post: 3rd Jun 2011, 07:05 PM
  4. [Selling] TwitterMoney.info, TopBetting.info, Watch-Shows.info (domains)
    By min123 in forum Completed Transactions
    Replies: 1
    Last Post: 29th May 2011, 12:52 PM
  5. [Selling] TwitterMoney.info, TopBetting.info, Watch-Shows.info (domains)
    By min123 in forum Completed Transactions
    Replies: 5
    Last Post: 26th May 2011, 02:18 PM

Tags for this Thread

BE SOCIAL