So basically what I want is for the submit button to be disabled until a certain word count has been reached in the text area. I have had a look around and tried to find ways to do it, with no luck. Any tips or help? Thanks!
That has nothing to do with PHP. That is all done via javascript. So next time please post in the correct board. <textarea style="width: 300px; height: 300xp;" id="text" onkeydown="checkWordCount();"></textarea> <input type="submit" name="submit" value="Submit" id="submit" disabled /> <script type="text/javascript"> function checkWordCount() { var wordCount = document.getElementById('text').value.split(" ").length; if (wordCount > 10) { document.getElementById('submit').disabled = false; } else { document.getElementById('submit').disabled = true; } } </script> Code (markup):
As above, it is done with Javascript - HOWEVER, I would recommend a PHP backup measure too to check the field for the desired length, as after all the user could have Javascript disabled
That is true but in this day and age only a very very small number of people have javascript disabled.