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. Link to comment https://forums.phpfreaks.com/topic/91544-how-to-check-user-input-type/ 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"; } ?> Link to comment https://forums.phpfreaks.com/topic/91544-how-to-check-user-input-type/#findComment-468916 Share on other sites More sharing options...
tmyonline Posted February 17, 2008 Author Share Posted February 17, 2008 Thanks Chris. I appreciate it! Link to comment https://forums.phpfreaks.com/topic/91544-how-to-check-user-input-type/#findComment-468918 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.