Stripping html

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob

    Stripping html

    The TitleField in my DB reads:

    Some title <span class=BoldRed>* </span>

    This shows up correctly, with the asterisk in the correct format, when
    shown on the web.

    I also want to show this field without any of the formatting; i.e.

    Some title *

    I've tried:
    $notags = stripslashes($r ow['title']);

    and also

    $notags = htmlspecialchar s($row['title']);

    but still get the tag info. How can I get rid of it?

  • Andy Hassall

    #2
    Re: Stripping html

    On 8 Dec 2006 16:16:53 -0800, "Bob" <bobr@whidbey.c omwrote:
    >The TitleField in my DB reads:
    >
    >Some title <span class=BoldRed>* </span>
    >
    >This shows up correctly, with the asterisk in the correct format, when
    >shown on the web.
    >
    >I also want to show this field without any of the formatting; i.e.
    >
    >Some title *
    >
    >I've tried:
    >$notags = stripslashes($r ow['title']);
    >
    >and also
    >
    >$notags = htmlspecialchar s($row['title']);
    >
    >but still get the tag info. How can I get rid of it?
    If only there were some way to search the manual...

    PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.


    The offical function listed there isn't perfect by any means, but it would
    seem to fit your requirement above, at least.

    --
    Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
    http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

    Comment

    • Christoph Burschka

      #3
      Re: Stripping html

      Bob wrote:
      The TitleField in my DB reads:
      >
      Some title <span class=BoldRed>* </span>
      >
      This shows up correctly, with the asterisk in the correct format, when
      shown on the web.
      >
      I also want to show this field without any of the formatting; i.e.
      >
      Some title *
      >
      I've tried:
      $notags = stripslashes($r ow['title']);
      >
      and also
      >
      $notags = htmlspecialchar s($row['title']);
      >
      but still get the tag info. How can I get rid of it?
      >
      The function you're looking for is striptags().

      --
      CB

      Comment

      • John Dunlop

        #4
        Re: Stripping html

        Christoph Burschka:
        The function you're looking for is striptags().
        Although as Andy said, strip_tags() isn't perfect.

        --
        Jock

        Comment

        Working...