ROCKINDANO Posted March 30, 2011 Share Posted March 30, 2011 i have a php form where users can update db. but when the input has a <a href=""></a> input, it generates back slashes on the web. below is the results after the input. <a href=\'\\\"images/gallery/storyslideshow/ppic-5 (1).jpg\'\\\" rel=\'\\\"lyteshow[featgallery]\'\\\" title=\'\\\"\'\\\">View Slideshow</a><br><br> i have a this on my updating code mysql_real_escape_string($_POST["fulldesc"]); Link to comment https://forums.phpfreaks.com/topic/232174-code-generates-back-slashes/ Share on other sites More sharing options...
JustLikeIcarus Posted March 30, 2011 Share Posted March 30, 2011 Take a look at this function. Should shed some light on your issue. http://php.net/manual/en/function.stripslashes.php Link to comment https://forums.phpfreaks.com/topic/232174-code-generates-back-slashes/#findComment-1194347 Share on other sites More sharing options...
ROCKINDANO Posted March 30, 2011 Author Share Posted March 30, 2011 don't think this works when inserting into a database? Link to comment https://forums.phpfreaks.com/topic/232174-code-generates-back-slashes/#findComment-1194349 Share on other sites More sharing options...
Pikachu2000 Posted March 30, 2011 Share Posted March 30, 2011 You don't want to arbitrarily apply stripslashes to data being pulled from a database. If slashes are coming out of the database, the problem usually likely exists before the point at which the data is being inserted. You should make sure magic_quotes_gpc is Off in your php.ini file, if you're able to do so. If you want to write code that's portable, when escaping data for insertion, first check for magic_quotes_gpc, and if it's On, apply stripslashes before escaping the data. If it's not On, escape the data normally without using stripslashes on it. Link to comment https://forums.phpfreaks.com/topic/232174-code-generates-back-slashes/#findComment-1194350 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.