Page 1 of 1
Those darn slashes
Posted: Sat Jun 22, 2002 9:25 pm
by ssand

I am having trouble with \ (backslashes) entered from a form and inserted to mysql. It is just leaving them off. I am using addslashes() but for the backslashes it doesn't seem to work??
Any tips?
Thanks - Steve
Magic Quotes
Posted: Mon Jun 24, 2002 4:58 am
by josa
Maybe the server you're using has magic quotes enabled for PHP. If this option is enabled PHP automatically adds slashes when form data is posted and if you use addslashes(), then another set of slashes is added. Echo out phpinfo() and look for magic_quotes_gpc under Configuration/PHP Core.
/josa
Posted: Tue Jun 25, 2002 7:56 am
by ssand
Yes, magic_quotes_gpc is ON. Do I still stripslashes? or is the magic_quotes_gpc catch that also?
Thanks - Steve
Posted: Tue Jun 25, 2002 8:09 am
by twigletmac
You still need to use stripslashes() to get rid of the added slashes because magic_quotes_gpc only affects data from a form and not stuff you've grabbed from the database.
Mac
Posted: Tue Jun 25, 2002 8:13 am
by ssand
Thanks - I'll give it a try!
