plznty Posted May 30, 2009 Share Posted May 30, 2009 How would I go around making an input area or box only allow numbers. 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. 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? 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+). 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
Archived
This topic is now archived and is closed to further replies.