View Full Version : minimum words

05-28-2004, 03:21 AM
I have seen some jvavascript like http://www.felgall.com/jstip42.htm where it counts the words as you type, but what i want it a reverse a countdown from 500 where after that they can post the item.
Why post here I hear you ask
Well I have heard that you can easily disable the javascript and then be able to post as little words as you want and so they suggested a serverside language like php so is there any chance of php being able to do that kind of thing?
Any advice or help is welocomed

05-28-2004, 03:41 AM
not in the same way , you can count words in a string using PHP but not until the user has submitted the form, so you can not do it in real-time, but imagine a form textarea field <textarea name="content">

then in the form's `action` page ...

$count=count( explode( ' ' , $_REQUEST['content'] ) ) ;
if( $count >= 500 ){
echo $count .' words submitted ';
echo 'content was less than 500 words (' . $count . ')';

05-28-2004, 05:15 AM
Have you tried modifying the javascript? it appears (and I could be dead wrong since I am close to clueless about writing javascripts) that the variable 'r' in the script is the actual counter. If you were to change r = 0 to r = 500 and the change r ++ to r -- , that would cause the counter to work in reverse order from 500 down.

just a thought