Re: validating textarea using php

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

 



On Tue, 13 May 2008, Sudhakar wrote:

hi

i need to validate textarea of a html form using php

<textarea name="comments" cols="26" rows="3" id="comments"><?php
echo($comments);?></textarea>

presently my php code to validate the text area is

if($comments == "" )
{
$error.="<br>Please enter your comments";
}

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.

please advice how i can change the above php code.

thanks.


if(chop($comments) == "") { ... }   //hope that helps.

--
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