I am currently using jQuery to check if the textarea has HTML in it: (and I will continue to use this)
if ($('textarea#newMessage').val().match(/<(\w+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/)) {
$('textarea#newMessage').focus();
$('#error').html('Error: HTML is not aloud. Please remove all of the HTML in your message to continue.')
.click(function() { $('#newMessage').focus(); })
.stop(true,true)
.fadeIn(800)
.delay(1500)
.fadeOut(200);
return false;
}
But, how can I use PHP to do this same thing? If someone disables JavaScript, they can easily submit the form with HTML in it. Is there a way for PHP to do this also?