Forum Moderators: coopster

Message Too Old, No Replies

Using strip_tags

No error but no effect!

         

henry0

7:38 pm on Dec 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello to save room on a search result page
I need to strip an HTML tag: <h1>
I tried the following"
Do not get an error but has no effect on the display result.
FYI the "title" is pulled from the DB and its formatting is part of the DB data.

$title = strip_tags($title, '<h1></h1><H1><H/1>');
echo("<td valign='top'>" . "$title" . "</td>\n");

I am doing anything wrong?
thanks

Henry

Birdman

7:46 pm on Dec 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm guessing that the forward slash is throwing the function off. Try removing the closing tags(and the uppercase versions) from the "allowable tags" parameter.

strip_tags($title, '<h1>');

henry0

8:03 pm on Dec 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Birdman
I think that you are indeed correct however I still get no result

thanks

Henry

Birdman

8:08 pm on Dec 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Wait...I think I misunderstood. You DO want to strip out the <h1>?

The example above will strip all tags except <h1>.

strip_tags($title, '<h1>'); // strip all tags but h1

strip_tags($title); // strip all tags

henry0

8:25 pm on Dec 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thank you
I miss explained, but you still understood my quest!

yes that's it I considered the function back word