RE: [PHP-DB] Forms : Validating user input is integer
| From: | Matt Williams | Date: | Thu, 05 Apr 2001 13:28:28 +0000 |
| Subject: | RE: [PHP-DB] Forms : Validating user input is integer | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-8273@lists.php.net to get a copy of this message | ||
> Whoops! Careless of me. The line should read, and as I tested it,
>
> elseif (eregi("[a-zA-Z]",$num)) { }
>
> Do you see any problem with this?
Yes, same thing it will accept other character like !*- etc...
try
if(!eregi("^[0-9]+[0-9]*$",$num)
{
//error
}
M@