Re: Forms : Validating user input is integer

From: Date: Sun, 08 Apr 2001 04:56:58 +0000
Subject: Re: Forms : Validating user input is integer
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-8347@lists.php.net to get a copy of this message
Hello boclair, On 05-Apr-01 01:58:24, you wrote: >I have a problem with a user input in a form required to be an >integer, creating a variable for a mysql query. >I have instances where integer, 0, is being typed as letter,o. >The last discussion of validating the input was >http://marc.theaimsgroup.com/?l=php-db&m=97207172003983&w=2 >There it was suggested that the only way to validate the input was >using javascript. I have a case where clients have disabled >javascript. >I tried fiddling with is_int($input) but of cause it does not serve >this purpose. >Does anybody know if such validation can be done server side or >definitely must be done client side? You may want to try this PHP form generation and validation class that does exactly what you need and more. http://phpclasses.UpperDesign.com/browse.html/package/1 It does both client and server side validation. For the client side it uses the isNaN(parseInt(value)) Javascript functions. For the server side it uses the strcmp($value,strval(intval($value))) PHP functions . Regards, Manuel Lemos Web Programming Components using PHP Classes. Look at: http://phpclasses.UpperDesign.com/?user=mlemos@acm.org -- E-mail: mlemos@acm.org URL: http://www.mlemos.e-na.net/ PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp --

« previous php.db (#8347) next »