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 Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
DJTim666 Posted July 5, 2007 Author Share Posted July 5, 2007 Woot. Thank's for your help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.