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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.