RE: validating textarea using php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> > with this code if a user hits the space bar once or couple 
> of times as 
> > a matter of fact there are no characters entered by the 
> user i do not 
> > want this to happen, if a user simply hits the spacebar and 
> does not 
> > type anything i should be able to display an alert message.

One thing you might consider is, first of all, there are many characters
which do not print and spaces are one of them, but from a computer
standpoint they are characters, tabs and new lines are some others, the list
goes on.

For this specific case you can trim the results and that often will
eliminate most of these if they appear at either end of what was typed, in
this case the entire thing.

If(trim($_POST["textareaname"]) == "") echo "You didn't type anything
significant!";

HTH,

Warren Vail


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux