Page 1 of 1

Php adds "/////////" to my $_POST vars

Posted: Sun Sep 24, 2006 6:51 am
by eyal
Hello,

When I send vars to another page via Post method, if i have ' or : or / PHP adds alot of "/////////" to my vars. Please tell me how can I overcome that problem?

Thank you,
Eyal.

Posted: Sun Sep 24, 2006 6:58 am
by Chris Corbyn
I imagine it adds backslashes not forward slashes:

\\\\

This is down to something called magic_quotes_gpc. Turn it off in php.ini but if you can't do that, use stripslashes().

Posted: Sun Sep 24, 2006 9:56 am
by eyal
Thanks man!
That was very helpful!

Posted: Sun Sep 24, 2006 12:39 pm
by Ambush Commander
You should probably define a function called magic_stripslashes() like this:

Code: Select all

function magic_stripslashes($string) {
    if (get_magic_quotes_gpc()) return stripslashes($string);
    else return $string;
}
So that your code doesn't break when you move it to a server that doesn't have stripslashes on.