Form input variable type interpretation problem
Posted: Thu Oct 30, 2008 2:10 pm
Hi. In the script processing a form I included conditional statement:
if((is_int($tireqty)==FALSE)||(is_int($oilqty)==FALSE)||(is_int($sparkqty)==FALSE)){
echo '<h1><b><font color=red>Wrong data inputted! Quantities have to be integers! </font></b></h1>';
exit;
}
where $tireqty, $oilqty and $soarkqty are input variables. However is_int() returns FALSE every time, because whatever data is inputted using the form, it is always interpreted as string type, which I checked using gettype() function. Why is that? Please help.
if((is_int($tireqty)==FALSE)||(is_int($oilqty)==FALSE)||(is_int($sparkqty)==FALSE)){
echo '<h1><b><font color=red>Wrong data inputted! Quantities have to be integers! </font></b></h1>';
exit;
}
where $tireqty, $oilqty and $soarkqty are input variables. However is_int() returns FALSE every time, because whatever data is inputted using the form, it is always interpreted as string type, which I checked using gettype() function. Why is that? Please help.