Nandini Posted August 19, 2008 Share Posted August 19, 2008 Hi all I want to validate a field with only numbers with php. I dont want to accept any letters, special characteres, space and floating numbers. Accept numbers only. I searched in google but those are accepting multi letters and floating numbers like "123abc" and "123.67" etc. But i want to accept numbers only. Can anyone send me regular expressions. Link to comment https://forums.phpfreaks.com/topic/120304-solved-php-regular-expressions/ Share on other sites More sharing options...
Andy-H Posted August 19, 2008 Share Posted August 19, 2008 if (!ctype_digit($var)){ echo "Integers only please..."; }else{ http://us3.php.net/manual/en/function.ctype-digit.php Link to comment https://forums.phpfreaks.com/topic/120304-solved-php-regular-expressions/#findComment-619802 Share on other sites More sharing options...
Nandini Posted August 19, 2008 Author Share Posted August 19, 2008 Thanq very much Andy. Its working fine. Thanq Link to comment https://forums.phpfreaks.com/topic/120304-solved-php-regular-expressions/#findComment-619803 Share on other sites More sharing options...
Andy-H Posted August 19, 2008 Share Posted August 19, 2008 No probs Link to comment https://forums.phpfreaks.com/topic/120304-solved-php-regular-expressions/#findComment-619804 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.