is_int with HTML FORM
| From: | TD - Sales International Holland B.V. | Date: | Fri, 30 Nov 2001 15:05:30 +0000 |
| Subject: | is_int with HTML FORM | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-76201@lists.php.net to get a copy of this message | ||
Hey there,
First of all please CC me as I'm no longer a member on this list. Sorry about
that but I receive too much :-(.
Please bear with me as I'm a new PHP scripter on the block....
Ok for the question. I was under the impression that PHP would automatically
select the type for the vars to use. However if I have a field in my form
where I insert only a 4 in I'd expect the var to be an integer (or atleast
some other whole number type of var). However is_int fails on the 4 and sees
it as a string. So how am I going to check whether it's nothing but digits
[0-9]. The field can hold 4 characters but they don't neccesarily need to be
filled. So the input could be 1 through 9999. Now I could check with > or <
but that won't work since they would still eval true if they'd enter 3a. Ok
it would fail if they'd enter a3 but that still leaves a possibility to crash
my script with 3a. Perhaps somebody could hand me a nice regexp or
something... I'm not yet familiar with those.
Kind regards and have a nice weekend.
Ferry van Steen