Results 1 to 3 of 3
  1. #1

    Escaping single quote

    Did a search already but couldn't seems to find the answer... anyway..

    I am having problem with escaping single quote '

    I am not sure about this but it appears to me that if I pass a string from one page to another, the characters needed to be escaped will have a backslash add before them automatically.

    The problem I am experiencing is that when I use backslash (via addslashes())in a string to escape a single quote, the result I got after passing it thru a hidden form to another page is the string with the added backsalsh getting backslashed ~-~ And everything after the 2 backslashes are missing...

    The following demonstartes how I ended up with 2 backslashes:

    action: Pass string "I'm a newbie" into another page
    result: "I\'m a newbie" get passed into another page

    action: use stripslashes() to remove backslash then display the content
    result: "I'm a newbie" displayed

    action: use addslashes() to add backslash to escape the single quote
    result: "I\'m a newbie"

    action: pass it onto another page thru hidden form <input type=....... value='$temp'), $temp stores the string
    result: attempting to display passed variable $temp and got "I\\" displayed.. everything else disappeared..

    I have no idea what's going on but it is really bugging me ~-~

    Could someone please help me with this???

  2. #2
    Join Date
    Dec 2001
    New Hampshire
    stripslashes(stripslashes($.. ))

    don't know if that helps any cause I really don't understand your situation, but sometimes that's what ya gotta do

  3. #3
    Join Date
    May 2002
    I can't remember exactly as I don't get this problem but it could be something to do with magic_quotes enabled or the various derivatives thereof?

Posting Permissions

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