bimbofred Posted June 10, 2007 Share Posted June 10, 2007 Hi, I have created a form. I made it so that when someone submits " or ' insted of echoing like this \" or \' it echos like this " or '. The code I used was this: $find = array("\"","\'"); $replace = array('"',"'"); $write = str_replace($find, $replace, $_GET["text"]); echo $write; The problem is it echos this \ insted of this " and this " insted of this '. Why? Link to comment https://forums.phpfreaks.com/topic/54999-i-have-a-problem-with-str_replace-plz-help/ Share on other sites More sharing options...
jaikar Posted June 10, 2007 Share Posted June 10, 2007 i think you are trying to add or strip slashes,, try to use addslashes and stripslashes ~J Link to comment https://forums.phpfreaks.com/topic/54999-i-have-a-problem-with-str_replace-plz-help/#findComment-271911 Share on other sites More sharing options...
Hypnos Posted June 10, 2007 Share Posted June 10, 2007 $find = array('\\"','\\\''); Of course, using stripslashes would be much easier. Sounds like you're hitting magic_quotes. Link to comment https://forums.phpfreaks.com/topic/54999-i-have-a-problem-with-str_replace-plz-help/#findComment-271917 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.