Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

parse int !

$
0
0

hello

i am asking the user to enter into a textfield a number .. of course , it will be entered as a string

how can i check whether his entry is a number? (integer)

is parsing it into int a solution? whats the function for parsing in php?

 

$foodCals = $_POST['foodCals'];
 
 
function checkCalories()
{
global $message,$foodCals;
if(is_int($foodCals)==false)
$message=" Calories should be a number!";
}

Viewing all articles
Browse latest Browse all 13200

Trending Articles