Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    me'
    me' is offline
    Senior Coder
    Join Date
    Nov 2002
    Location
    Warwickshire, England
    Posts
    1,229
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Stopping <textarea> from espcaping quotes

    I'm trying to build a simple CMS, and I have the following code for the textarea:
    Code:
    <textarea name="post" rows="10" cols="50" tabindex="2"></textarea>
    The problem is, I can access the data it posts and everything is well, except normally I'm echoing it straight back into HTML, which means that the backslashes that the textarea presumably automattically puts in there show up as backslashes. HTML doesn't need you to escape ' or ", so how do you stop the textarea from doing it automatically?
    David House - Perfect is achieved, not when there is nothing left to add, but when there is nothing left to take away. (Antoine de St. Exupery).
    W3Schools | XHTML Validator | CSS Validator | Colours | Typography | HTML&CSS FAQ | Go get Mozilla Now | I blog!

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,266
    Thanks
    6
    Thanked 48 Times in 48 Posts
    http://www.php.net/stripslashes

    PHP Code:
    <textarea name="post" rows="10" cols="50" tabindex="2">
    <?php
    echo stripslashes($str);
    ?>
    </textarea>
    Sometimes you might have to do
    PHP Code:
    <textarea name="post" rows="10" cols="50" tabindex="2">
    <?php
    echo stripslashes(stripslashes($str));
    ?>
    </textarea>

  • #3
    me'
    me' is offline
    Senior Coder
    Join Date
    Nov 2002
    Location
    Warwickshire, England
    Posts
    1,229
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Heh, should have looked for something like that before I posted, I guess.

    Thanks for the help
    David House - Perfect is achieved, not when there is nothing left to add, but when there is nothing left to take away. (Antoine de St. Exupery).
    W3Schools | XHTML Validator | CSS Validator | Colours | Typography | HTML&CSS FAQ | Go get Mozilla Now | I blog!


  •  

    Posting Permissions

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