SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    boiler up blackdog's Avatar
    Join Date
    Jul 2002
    Location
    Purdue
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    removing html from shoutbox

    i've got a shotbox i made in php, and i'm trying to make it so that all html tags are removed from shouts. i'm just starting php, so i'm not sure what would be the best way to go about doing this... the only thing i can think of is explode each shout at each "<". that will keep html code from running, but then shouts would look like this: src=""google.com/image.jpg>

    any suggestions on how to do this better?

  2. #2
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use the strip_tags() function

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  3. #3
    boiler up blackdog's Avatar
    Join Date
    Jul 2002
    Location
    Purdue
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks! i have so much to learn

  4. #4
    boiler up blackdog's Avatar
    Join Date
    Jul 2002
    Location
    Purdue
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    one more quick question...

    how can i get special characters like an apostrophe to display correctly, instead of showing up like '/ ?

    i've got $message=HTMLSpecialChars($message); right now, but that isn't working
    Last edited by blackdog; Jun 4, 2003 at 18:07.

  5. #5
    SitePoint Enthusiast int3rface's Avatar
    Join Date
    Jun 2003
    Location
    Hull
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i think it should be htmlspecialchars in lower case

  6. #6
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    and you should stripslashes() it, if magic_quotes_gpc is on and you are not inserting it into a db.
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.

  7. #7
    boiler up blackdog's Avatar
    Join Date
    Jul 2002
    Location
    Purdue
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cyborg from dh
    and you should stripslashes() it, if magic_quotes_gpc is on and you are not inserting it into a db.
    worked like a charm thanks


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
  •