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

Thread: removing "\"

  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Depends on the time of year
    Posts
    478
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy removing "\"

    I insert data into my forms, but everytime i put in an apostrophe or anything like that, it's preceded with a "\" I looked for a function somewhere, of course with my wonderfully slow internet connection, i get no where with my search and this miraculous book that is obsenely bad in explaining things to beginners. Just curious if someone could tell me the function or the steps to remove the '\' preceding any of the key variables.

    thanks
    umang

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Location
    U.S. (Wish Japan though)
    Posts
    141
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Gorilla1 had already posted this question at:

    Backslash shows up in textarea content save to file?

    Hope that thread can help you

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Depends on the time of year
    Posts
    478
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up thanks...

    checked out the strip_slash function

    http://www.php.net/manual/en/function.stripslashes.php

    but i realized that i put add_slash function right before the adding the lines to my table (smart huh? ) and just removed them, that did the trick.

    Thanks
    Umang

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ehm... does that mean you have magic_quotes turned on and rely on them?

    Ugh... I would favor control escaping of special characters explicitly with addslashes() and stripslashes() over that automagical mechanism, but each to his own.

    Though I still believe that magic_quotes cause confusion that could be avoided.

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Posts
    553
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I would favor control escaping of special characters explicitly with addslashes() and stripslashes() over that automagical mechanism, but each to his own.
    mordred,

    Agree, but If you don't have the ability to determine that on your server, from what I have read, you can't turn it off effectively locally.

    G

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    AFAIK, you can do that directly from within PHP with ini_set (well, if that function is allowed on the server).

    You can also put php_value/php_flag directive in your .htaccess file, if you are permitted using one.

    And yes, an extremely paranoid admin may disallow any of the possibilities. I only thought it would be worth mentioning that relying on magic_quotes may not be the best thing to do.

  • #7
    Regular Coder
    Join Date
    Jun 2002
    Location
    Depends on the time of year
    Posts
    478
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hey, since you waaaaay more experienced in PHP than I am, might as well listen to you and just use the two functions to add and strip the slashes anyway, might as well learn through someone's experience and not mess up later on.

    Thanks again for your comments, I was just trying to figure out the lazy way out of typing less.. , no point

    Later
    Umang


  •  

    Posting Permissions

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