Re: form validation
| From: | Morgan Curley | Date: | Thu, 12 Apr 2001 20:58:05 +0000 |
| Subject: | Re: form validation | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-48365@lists.php.net to get a copy of this message | ||
<?php
if( $my_form_var % 50 ){
echo "$my_form_var is not a multiple of 50!";
}
?>
the % is the modulus operator meaning it returns the remainder of a division operation. If the number is divisible by 50 the remainder is 0 ( aka false for the if statement ) other wise it is not 0 ( aka true )
http://www.php.net/manual/nl/language.operators.php
morgan
At 04:42 PM 4/12/2001, you wrote:
I have to make sure that a number entered into a field is divisible by 50 but I am unsure how to validate the number to make sure that is the case before it goes into the db. george -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net