Imad Posted March 10, 2008 Share Posted March 10, 2008 Hi guys, I'm trying to disallow html and php from form fields. So far I have this: if ($comment && preg_match('<iframe>', '</iframe>', '<frame>') { echo "$comment"; } It doesn't seem to work. Their has to be another trick instead of putting all the html tags in. Any help would be greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/95521-disallowing-html-help/ Share on other sites More sharing options...
Northern Flame Posted March 10, 2008 Share Posted March 10, 2008 try htmlentities() Link to comment https://forums.phpfreaks.com/topic/95521-disallowing-html-help/#findComment-488978 Share on other sites More sharing options...
Imad Posted March 10, 2008 Author Share Posted March 10, 2008 Thanks, that worked. Link to comment https://forums.phpfreaks.com/topic/95521-disallowing-html-help/#findComment-489012 Share on other sites More sharing options...
dotBz Posted March 11, 2008 Share Posted March 11, 2008 what about strip_tags()? :-\ Link to comment https://forums.phpfreaks.com/topic/95521-disallowing-html-help/#findComment-489017 Share on other sites More sharing options...
Imad Posted March 11, 2008 Author Share Posted March 11, 2008 what about strip_tags()? :-\ Strip_tags allows you to select tags that can be used in forms. htmlentities() did what I needed. Thanks, Imad. Link to comment https://forums.phpfreaks.com/topic/95521-disallowing-html-help/#findComment-489031 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.