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.
views:
42answers:
2
+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
2010-08-17 11:36:09
Whether is it possible to `magic_quotes_gpc = Off` in run time
vinothkumar
2010-08-17 11:39:53
@vinothkumar of course not. for obvious reason
Col. Shrapnel
2010-08-17 11:46:10
Sometimes we haven't apotunity to change this setting.
Alexander.Plutov
2010-08-17 11:50:04
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
2010-08-17 11:52:23
+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
2010-08-17 11:41:58
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
2010-08-17 12:00:39