Hello Matt, Friday, May 7, 2004, 9:33:28 AM, you wrote:
MP> Hey, I was wondering if anyone knows of any easy ways to detect for HTML MP> input. I have a textarea box that I want users to be able to input either MP> plain text or HTML code. I will later display this input data, so if the MP> user input plain text then I will replace newline characters (\r\n, \n, \r) MP> with <br> tags, but if they input HTML code I don't want to format it before MP> displaying it. Basically is there an easy way to detect HTML code in MP> inputs? If you have any suggestions, please let me know. Just one way of doing this, but... $userinput = 'blah blah <b>bold!</b> blah'; $test_html = strip_tags($userinput); if ($userinput !== $test_html) { echo 'They included html!'; } else { echo 'Plain text'; } -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php