DJTim666 Posted July 5, 2007 Share Posted July 5, 2007 I am trying to make it so that I can have my own code for my website. It doesn't seem to be converting the code using str_replace() before insertin it into the DB. Below is the code I am using. $profile = $_POST[newprofile]; str_replace("[br]", "<br>", $profile); str_replace("[u]", "<u>", $profile); str_replace("[/u]", "</u>", $profile); str_replace("[b]", "<b>", $profile); str_replace("[/b]", "</b>", $profile); str_replace("[img]", "<img src='", $profile); str_replace("[/img]", "'>", $profile); str_replace("[url]", "<a href='", $profile); str_replace("[/url]", "'>Website</a>", $profile); str_replace("[hr]", "<hr>", $profile); str_replace("<", "", $profile); str_replace("/>", "", $profile); str_replace(">", "", $profile); //code here....... mysql_query("UPDATE user_profiles SET profile='$profile' WHERE username='$Yourname'"); -- DJ Link to comment https://forums.phpfreaks.com/topic/58588-solved-str_replace/ Share on other sites More sharing options...
effigy Posted July 5, 2007 Share Posted July 5, 2007 str_replace does not modify the original; you need to set the original to its return value. You can also clean up your code by putting your searches and replaces in an array. Link to comment https://forums.phpfreaks.com/topic/58588-solved-str_replace/#findComment-290610 Share on other sites More sharing options...
DJTim666 Posted July 5, 2007 Author Share Posted July 5, 2007 Woot. Thank's for your help. Link to comment https://forums.phpfreaks.com/topic/58588-solved-str_replace/#findComment-290614 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.