Because it's a string. You can use regex matching or test
whether floor($var) == $var, for example.
Steve
At 4/29/2001 04:25 AM, Jamie Saunders wrote:
>Hi,
>
>I'm submitting a phone number from an HTML form to a PHP page
>that examines it to see if it's an integer:
>
>form.html:
>
>validate.ph
It's a string, not an integer. Try using is_numeric() instead. To see
what type it is, do this :
echo gettype($phonenumber); // prints string
You may want to strip all non-numbers first, just in case they enter :
333-333-
Something like :
$phonenumber = preg_replace('/[^0-9]/','
Hi,
I'm submitting a phone number from an HTML form to a PHP page that examines
it to see if it's an integer:
form.html:
validate.php:
However, for some reason the script doesn't recognize the number as an
Integer - why is this and how can I remedy it?
Jamie Saunders
Mail: [EM
3 matches
Mail list logo