Jump to content

strip_tags not working


sb13

Recommended Posts

Heya

 

 

I have a problem with stripping HTML from some text with strip_tags. I am in the unfortunate situation to be working on a system where the previous developer loved to throw HTML, CSS and JavaScript straight into the database and not filter it when extracting it. Therefore, I need to filter some of the crap he threw in. :)

 

Here is some code:

 

$details = Person::getPersonDetails($id); // Returns MySQL object data set (I know!) from mysql_fetch_object
echo strip_tags($details->description); // I want to remove HTML from the description property, but the HTML is still displayed after using strip_tags

 

 

Any ideas? Thanks!

Link to comment
Share on other sites

Most likely it is not HTML but HTML that was run through htmlentities().  View the page source and see if you have < > etc...

Well, if it was content run through htmlentities() then it wouldn't be rendered as HTML, but maybe that is the case. I agree that (or something like it) is the problem.

 

@OP: It would be helpful to show a sample of the content before and after running through strip_tags().

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.