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!"; } Quote Link to comment https://forums.phpfreaks.com/topic/278163-parse-int/ Share on other sites More sharing options...
Solution requinix Posted May 19, 2013 Solution Share Posted May 19, 2013 To see if they've entered only numbers and nothing else? ctype_digit Quote 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 ) Quote Link to comment https://forums.phpfreaks.com/topic/278163-parse-int/#findComment-1430961 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.