plznty Posted May 30, 2009 Share Posted May 30, 2009 How would I go around making an input area or box only allow numbers. Quote Link to comment https://forums.phpfreaks.com/topic/160214-solved-number-only-input-area/ Share on other sites More sharing options...
Ken2k7 Posted May 30, 2009 Share Posted May 30, 2009 Have JavaScript to disallow any characters that is not a number. Have PHP do some validation on the back-end as well in case the user has JavaScript disabled. Quote Link to comment https://forums.phpfreaks.com/topic/160214-solved-number-only-input-area/#findComment-845380 Share on other sites More sharing options...
plznty Posted May 30, 2009 Author Share Posted May 30, 2009 Example of javascript code? Quote Link to comment https://forums.phpfreaks.com/topic/160214-solved-number-only-input-area/#findComment-845384 Share on other sites More sharing options...
Maq Posted May 30, 2009 Share Posted May 30, 2009 Example of javascript code? http://www.codetoad.com/javascript/isnumeric.asp You should also check server-side, what language are you using? If PHP, you can use isNumeric, or better yet just check it with regex (\d+). Quote Link to comment https://forums.phpfreaks.com/topic/160214-solved-number-only-input-area/#findComment-845400 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.