fife Posted March 28, 2011 Share Posted March 28, 2011 can somebody please tel me how to make sure a field is a number? I have some error checking like if(empty($postcode)) { $errors[] = "Please enter your postcode"; } if(strlen($tel)<11) { $errors[] = "Please enter a phone number that is the correct length"; } But I dont know and cant find how to check for a number only. Quote Link to comment https://forums.phpfreaks.com/topic/231967-error-checking/ Share on other sites More sharing options...
shlumph Posted March 28, 2011 Share Posted March 28, 2011 Two options are is_int() or using a regular expression. Edit: is_int() not is_integer() Quote Link to comment https://forums.phpfreaks.com/topic/231967-error-checking/#findComment-1193322 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.