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
https://forums.phpfreaks.com/topic/245490-strip_tags-not-working/
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().

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.