Jump to content

parse int !


farahZ

Recommended Posts

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!";
}
Link to comment
https://forums.phpfreaks.com/topic/278163-parse-int/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.