...

removing "\"

duniyadnd
07-22-2002, 06:32 AM
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

Cloudski
07-22-2002, 06:40 AM
Gorilla1 had already posted this question at:

http://www.codingforums.com/showthread.php?s=&threadid=2242

Hope that thread can help you :thumbsup:

duniyadnd
07-22-2002, 07:07 AM
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? :D ) and just removed them, that did the trick.

Thanks
Umang

mordred
07-22-2002, 12:33 PM
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.

gorilla1
07-22-2002, 01:06 PM
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

mordred
07-22-2002, 02:32 PM
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.

duniyadnd
07-22-2002, 02:37 PM
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.. :D, no point

Later
Umang



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum