Results 1 to 4 of 4

Thread: [RESOLVED] Escape Characters

  1. #1

    Thread Starter
    Hyperactive Member BillGeek's Avatar
    Join Date
    Jun 2006
    Location
    Canada
    Posts
    440

    Resolved [RESOLVED] Escape Characters

    I have an odd problem. See the following two simple scripts:
    HTML Code:
    <form id='testForm' action='submit.php' method='post'>
        <textarea id='testText'></textarea>
        <input type='submit' />
    </form>
    PHP Code:
    <?php
        
    die($_POST["testText"]);
    ?>
    When you enter anything in the textarea, the PHP script immediately contains escape characters. For example: If I type: "It's good", the php script will print out "It\s good".

    This only happens on my hosted solution though. The host is using Linux (don't know which distro) with php 5.0, though on my local machine using WAMP server (php 5.2.6) this doesn't happen. I can enter just about anything without escape characters returning.

    Does anyone know why this is happening and how to correct it?

  2. #2

  3. #3
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: [RESOLVED] Escape Characters

    if you don't want to bother with your htaccess file, you could also just use stripslashes().

  4. #4

    Thread Starter
    Hyperactive Member BillGeek's Avatar
    Join Date
    Jun 2006
    Location
    Canada
    Posts
    440

    Re: [RESOLVED] Escape Characters

    I've been using stripslashes, though I've had some issues with it that I'd rather not go into now. (Tripping over mysql_real_escape_string, etc...)

    I'm now just going to use str_replace to replace all "reserved" characters with HTML codes.
    (EG: apostrophe -> & # 3 9 ; )

Posting Permissions

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



Click Here to Expand Forum to Full Width