- Impact
- 19
HEY
i am trying to learn php and i tried making a small script that tells the user to type in a number...and checks if its an integer..if its not an integer it gives an error..but its not working...no matter wt they enter..it says that its not an integer
here is the code
i am trying to learn php and i tried making a small script that tells the user to type in a number...and checks if its an integer..if its not an integer it gives an error..but its not working...no matter wt they enter..it says that its not an integer
here is the code
PHP:
Please enter some numbers..ONLY NUMBERS<br>
<form action="<?$_SERVER[PHP_SELF]?>" method='post'><br>
<input type='text' name='input'> <br>
<input type='Submit' name='Submit' value='Submit'>
</form>
<?
$stuff=$_POST['input'];
$submit= $_POST['Submit'];
$get = gettype($stuff);
$get=gettype($stuff);
if (isset($submit)){
if ($get != 'integer') {
echo "You posted $stuff and its not an integer";}
else
{echo "thanks " ;}
}
else
{}
?>







