tags:

views:

42

answers:

2

When I pass a value from Jquery (For Example test's name) in post method.When I get the the same value in PHP and return it I got like this
test\'s name.I don't know why?
I used the encode URI also.Thanks in advance.

+3  A: 

You must have magic quotes option turned on in your php.

Try to set

magic_quotes_gpc = Off

in your configuration.

killer_PL
Whether is it possible to `magic_quotes_gpc = Off` in run time
vinothkumar
@vinothkumar of course not. for obvious reason
Col. Shrapnel
Sometimes we haven't apotunity to change this setting.
Alexander.Plutov
Then you need to put in place precautions to make your websites/applications more portable. `$value = (get_magic_quotes_gpc()) ? stripslashes($value) : $value;` does the trick.
Martin Bean
+1  A: 

If your hoster doesn't permit you to change a php configuration, you can use this function for POST, GET.. arrays.

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

    return $value;
}
if((function_exists("get_magic_quotes_gpc") && get_magic_quotes_gpc())    || (ini_get('magic_quotes_sybase') && (strtolower(ini_get('magic_quotes_sybase'))!="off")) ){
    stripslashes_deep($_GET);
    stripslashes_deep($_POST);
    stripslashes_deep($_COOKIE);
}
?>
Alexander.Plutov
Ya it is remove the magic Quotes.Thanks for everyone for your quick responses.Now I got the little bit knowledge on this and solved my problem.Thanks once again.
vinothkumar