Is $a an interger?
| From: | L.T. Harris | Date: | Tue, 07 Nov 2000 16:41:55 +0000 |
| Subject: | Is $a an interger? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-24118@lists.php.net to get a copy of this message | ||
Hi folks, this probably qualifies as a dumb newbie question.
I want to use PHP to make sure a value submitted in a form is an integer, if
not I want to prompt the user to change that value.
However I have discovered that no matter what I do PHP thinks values
submitted from the form are strings. I tired using settype() but that
changes the value to 0, and when the form is resubmitted the type changes
again to string.
My brilliant (but non functional code) is\
$type=gettype($var1);
if ($type=="integer")
...
} else {
if ($type="string") {
settype($var1, "integer")
...//stuff to show form again
}
}
What do I need to do to make PHP think the values submitted by the form are
integers
Thanks,