Roy766 Posted May 26, 2008 Share Posted May 26, 2008 How could I make it so that the browser checks for a whole number from a textbox? So that if the user types in 13.99 into a textbox, it echoes 'Please enter a whole number!', or something along those lines? Link to comment https://forums.phpfreaks.com/topic/107348-check-for-whole-number-in-textbox/ Share on other sites More sharing options...
pocobueno1388 Posted May 26, 2008 Share Posted May 26, 2008 Use the is_int() function. Link to comment https://forums.phpfreaks.com/topic/107348-check-for-whole-number-in-textbox/#findComment-550380 Share on other sites More sharing options...
.josh Posted May 26, 2008 Share Posted May 26, 2008 also if you're wanting a popup that's a clientside script's department, like javascript. Link to comment https://forums.phpfreaks.com/topic/107348-check-for-whole-number-in-textbox/#findComment-550383 Share on other sites More sharing options...
serverman Posted May 30, 2008 Share Posted May 30, 2008 like this! <?php $n = 12.2; if (is_int($n)){ //somescript }else{ echo '<script> alert("Please use a whole number"); </script>';}?> Link to comment https://forums.phpfreaks.com/topic/107348-check-for-whole-number-in-textbox/#findComment-553161 Share on other sites More sharing options...
.josh Posted May 30, 2008 Share Posted May 30, 2008 like this! <?php $n = 12.2; if (is_int($n)){ //somescript }else{ echo '<script> alert("Please use a whole number"); </script>';}?> /fail Link to comment https://forums.phpfreaks.com/topic/107348-check-for-whole-number-in-textbox/#findComment-553195 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.