farahZ Posted May 19, 2013 Share Posted May 19, 2013 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 More sharing options...
requinix Posted May 19, 2013 Share Posted May 19, 2013 To see if they've entered only numbers and nothing else? ctype_digit Link to comment https://forums.phpfreaks.com/topic/278163-parse-int/#findComment-1430960 Share on other sites More sharing options...
farahZ Posted May 19, 2013 Author Share Posted May 19, 2013 thankss !! solved ) Link to comment https://forums.phpfreaks.com/topic/278163-parse-int/#findComment-1430961 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.