SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: HTML filtering

  1. #1
    SitePoint Zealot Xia's Avatar
    Join Date
    Aug 2003
    Location
    Belgium
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HTML filtering

    What is the best and most efficient (fastest) way to allow only certain html tags to appear in a form field value?

    i.e. only <b></b> <i></i> <font (size="") (color="")></font> <p></p> are allowed. The rest should be htmlspecialcharred or something similar.

    Thanks

  2. #2
    Tranceoholic lilleman's Avatar
    Join Date
    Feb 2004
    Location
    Írebro, Sweden
    Posts
    2,716
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Take a look at the function strip_tags.
    ERIK RIKLUND :: Yes, I've been gone quite a while.

  3. #3
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Xia
    What is the best and most efficient (fastest) way to allow only certain html tags to appear in a form field value?

    i.e. only <b></b> <i></i> <font (size="") (color="")></font> <p></p> are allowed. The rest should be htmlspecialcharred or something similar.

    Thanks

    I'd recommend Safe HTML


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •