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. Quote 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"; } ?> Quote 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 Quote 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/ Quote Link to comment https://forums.phpfreaks.com/topic/89544-php-validation/#findComment-458833 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.