sb13 Posted August 23, 2011 Share Posted August 23, 2011 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! Quote Link to comment https://forums.phpfreaks.com/topic/245490-strip_tags-not-working/ Share on other sites More sharing options...
AbraCadaver Posted August 23, 2011 Share Posted August 23, 2011 Most likely it is not HTML but HTML that was run through htmlentities(). View the page source and see if you have < > etc... Quote Link to comment https://forums.phpfreaks.com/topic/245490-strip_tags-not-working/#findComment-1260949 Share on other sites More sharing options...
Psycho Posted August 23, 2011 Share Posted August 23, 2011 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(). Quote Link to comment https://forums.phpfreaks.com/topic/245490-strip_tags-not-working/#findComment-1260958 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.