tmyonline Posted February 17, 2008 Share Posted February 17, 2008 Hi guys: I have a form that takes in user input. I need to check to make sure that users enter a number instead of a string or other miscellaneous types. How do I approach this ? Thanks. Quote Link to comment Share on other sites More sharing options...
Chris92 Posted February 17, 2008 Share Posted February 17, 2008 To make sure it's a number use the is_numeric() function: <?php if( !is_numeric($_POST['number']) ) { echo "please insert a number"; } ?> Quote Link to comment Share on other sites More sharing options...
tmyonline Posted February 17, 2008 Author Share Posted February 17, 2008 Thanks Chris. I appreciate it! Quote Link to comment 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.