cooldude832 Posted November 20, 2007 Share Posted November 20, 2007 I have a month number coming in from get $_GET['month'] and I want to verify it is in proper form any ideas beyond <?php if($_GET['month'] >0 && $_GET['month'] <13 && is_int($_GET['month'])) ?> ?? Link to comment https://forums.phpfreaks.com/topic/78032-best-way-to-check-integer-based-get-variables/ Share on other sites More sharing options...
PHP_PhREEEk Posted November 20, 2007 Share Posted November 20, 2007 $_GET will not be an integer until you set it as an integer. All POSTed or GET values are strings at first, so.. <?php $month = intval($_GET['month']); if( $month > 0 && $month <13 ) { //do whatever } ?> PhREEEk Link to comment https://forums.phpfreaks.com/topic/78032-best-way-to-check-integer-based-get-variables/#findComment-394965 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.