Jump to content

[SOLVED] str_replace()


DJTim666

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.