I have a form posting data to a php page. Then I have the PHP page echoing the data aswell as posting it to twitter. Whenever In a word with an apostrophe it adds a back-slash right before it. So I type in "I'm going to the park" it echos "I\'m going to the park" what's going on and how do I fix it? Thanx :)
A:
magic_quotes_gpc is on.. i'd turn it off in your php.ini or server settings panel (depending on your host)
edited to the, although somewhat painful, support of Col. Shrapnel..
Dan Heberden
2010-06-11 06:11:19
think better :)
Col. Shrapnel
2010-06-11 06:19:46
@Col. Shrapnel Please elaborate.
Sjoerd
2010-06-11 06:21:02
care to elaborate?
Dan Heberden
2010-06-11 06:21:03
try it and see if it really works. then try to think - why. It is not too hard to make assistance necessary ;)
Col. Shrapnel
2010-06-11 06:23:20
Dan Heberden
2010-06-11 06:27:53
+1
A:
This is caused by magic_quotes, a configuration option you should turn off. See here for good explanations.
deceze
2010-06-11 06:11:53
+1
A:
you can turn it off in the php.ini or .htaccess
or just get rid in place:
if (get_magic_quotes_gpc()) foreach($_POST as $k=>$v) $_POST['$k'] = stripslashes($v);
Col. Shrapnel
2010-06-11 06:22:14