int is not an int!
Posted: Fri Apr 27, 2007 3:12 pm
i have an input form with some fields. obviously i dont want people to add strings to text fields.
this is the attribute in question:
when the form is submitted, this happens:
and this is the test
for some reason if i type in an integer or a string, this test always fails and the echo statement fires saying it is not an int. i thought php automatically converted strings to int if valid?
can anyone help?
thanks
this is the attribute in question:
Code: Select all
<p><input type = "text" name = "newpreptime" /></p>Code: Select all
$newpreptime=$_POST['newpreptime'];Code: Select all
if (is_int($newpreptime))
{
echo"this is a int";
}
else
{
echo"this is not a int";
}can anyone help?
thanks