Stripping HTML tags, but keeping entities...
| From: | David Russell | Date: | Wed, 20 Nov 2002 15:25:06 +0000 |
| Subject: | Stripping HTML tags, but keeping entities... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-125246@lists.php.net to get a copy of this message | ||
Hi all
I have a text field that users can enter any information into (it is
supposed to be a description field)
For obvious reasons, I want to strip unfriendly HTML/PHP tags. This I am
doing using:
strip_tags($_POST['Duplicate'], '<B> <I> <P> <A> <LI>
<OL> <UL> <EM>
<BR> <TT> <STRONG> <BLOCKQUOTE> <DIV> <ECODE> ');
OK, so this is cool. I got this list from the Slashdot allowed tags
list, which I would assume is ok. Now I get someone sending me
information such as:
"In fact the value of the destination is < the source."
Strip_tags removes all info after the < sign. Obviously I would like to
convert it to a > entity, but how can I do both of these?
Thanks for any advice.
David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250
Fax: +2711 444-7256
e-mail: DavidR@BarloworldOptimus.com
web: www.BarloworldOptimus.com
Attachment: [application/x-pkcs7-signature] smime.p7s
Attachment: [application/x-pkcs7-signature] smime.p7s