halocursed
halocursed

Reputation: 2495

post data changing on submit

When I submit data in my form it changes "abcd" to \"abcd\" on the other end.How can I overcome this problem... (I am using post method to send data)..... Please help...Thanks

Upvotes: 0

Views: 262

Answers (2)

Mez
Mez

Reputation: 24943

This is generally due to magic_quotes.

Something similar to

<?php
if (get_magic_quotes_gpc()) {
    function stripslashes_deep($value)
    {
        $value = is_array($value) ?
                    array_map('stripslashes_deep', $value) :
                    stripslashes($value);

        return $value;
    }

    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
    $_REQUEST = array_map('stripslashes_deep', $_REQUEST);
}
?>

Should switch them off. I'd reccomend switching them off in your configuration though..

https://www.php.net/manual/en/security.magicquotes.disabling.php

Upvotes: 9

Gumbo
Gumbo

Reputation: 655309

That are probably Magic Quotes. You can disable them by disabling magic_quotes_gpc (either in a .htaccess file or in the server configuration).

Upvotes: 0

Related Questions