At 08:00 28-6-04, you wrote:
Hi,

Just wondering if there is a way in php to filter out FONT tags when
inserting
a record from a textarea so information appears with the standard defined
CSS style
on detail/result pages?

Any help would be greatly appreciated

You can use the striptags function to filter all html (recommended when everybody can insert text: it is possible to insert malignant code!), or allow only certain tags with the same function.


If you trust the people who enter html, and realy only want to filter the font tag, i think this calls for a regular expression.

If you think they do not make typo's, use the str_replace function to directly replace the font tag with a span tag.

Simply removing all (matching) font tags:
$text=preg_replace( "/<font[^>]*>(.*)<\/font>/Ui", "\\1", $text );
preg_replace will take a bit more time than str_replace. But if you think they may make typo's, it may be better.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to