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? Quote 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. Quote 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. Quote 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>';}?> Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.