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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
eyal
Forum Newbie
Posts: 19
Joined: Mon Jun 19, 2006 11:03 am

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

Post 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.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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().
eyal
Forum Newbie
Posts: 19
Joined: Mon Jun 19, 2006 11:03 am

Post by eyal »

Thanks man!
That was very helpful!
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post 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.
Post Reply