JSHINER Posted February 27, 2009 Share Posted February 27, 2009 I have a form where a user enters a username. I want it to kick back an error if they enter their email address. How can I get it to see if a "@" or "." is in the entry? Link to comment https://forums.phpfreaks.com/topic/147162-solved-quick-validation-question/ Share on other sites More sharing options...
rhodesa Posted February 27, 2009 Share Posted February 27, 2009 first, for usernames, I usually use their email anyways. keeps things simpler IMO but, if you want to make sure they don't use their email, just make it so their username has to be alphanumeric and underscores. in php you can use if(!preg_match('/^\w+$/',$email)) die("Invalid username"); Link to comment https://forums.phpfreaks.com/topic/147162-solved-quick-validation-question/#findComment-772532 Share on other sites More sharing options...
JSHINER Posted February 27, 2009 Author Share Posted February 27, 2009 Thanks! Link to comment https://forums.phpfreaks.com/topic/147162-solved-quick-validation-question/#findComment-772539 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.