cozzy1984 Posted February 5, 2008 Share Posted February 5, 2008 Hi was just wondering if there is an easy way of validating if a fields has invalid characters or spaces. As I want username to have no spaces or invalid characters. Probably easy but just can't seem to find the answer. Have been trying preg_match. Link to comment https://forums.phpfreaks.com/topic/89544-php-validation/ Share on other sites More sharing options...
trq Posted February 5, 2008 Share Posted February 5, 2008 <?php if (!preg_match('/^[a-zA-Z]$/',$data) { echo "invlid chars found"; } ?> Link to comment https://forums.phpfreaks.com/topic/89544-php-validation/#findComment-458671 Share on other sites More sharing options...
cozzy1984 Posted February 5, 2008 Author Share Posted February 5, 2008 cheers i had one like tht but it doesnt check for spaces Link to comment https://forums.phpfreaks.com/topic/89544-php-validation/#findComment-458675 Share on other sites More sharing options...
vidyadoiphode Posted February 5, 2008 Share Posted February 5, 2008 You can get some good links here. http://php-infosource.blogspot.com/ Link to comment https://forums.phpfreaks.com/topic/89544-php-validation/#findComment-458833 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.