Forum Moderators: coopster

Message Too Old, No Replies

Counting words remaining in a Textarea

         

only1perky

3:13 pm on Nov 26, 2007 (gmt 0)

10+ Year Member



Hi guys,

I have a page which allows users to write a description about their business. Now depending on which type of membership they have signed up I would like them to have a set amount of words to use.

Membership Type/-Amount of Words

Basic/-50
Promotional/-500
Premium/- 1000
Platinum/-2000
Professional/-3500

The type of membership is pulled from the database as 'exhibitor_type'.

Can anyone offer me a solution of how to achieve this efficiently.

Cheers in advance guys.

henry0

4:44 pm on Nov 26, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<?php

$str = "aaa bbbb ccc";

$str = count(explode(" ", $str));

echo "$str";

?>
That should do the trick

phranque

2:15 am on Nov 27, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



if you are trying to show this dynamically to the user in the form/browser rather than waiting for the POST to validate in your php script, you will probably have to use javascript.
if you search for something like "javascript word counter" you should find some suitable solutions...