troubleshooting Question

Function to check username without spaces

Avatar of genesisvh
genesisvh asked on
PHP
5 Comments3 Solutions308 ViewsLast Modified:
Ok so I'm still having problems. This is what I need:
I want a function to echo a message if a username does not pass my requirments.

  - Only letters and / or numbers
 - Must start with a letter (not a number)
 - No spaces

The current code is not working for me. Please help
}else if (!(eregi('/[^\w\'\"\@\-\.\]/i', '',($_POST["username"])))){
		echo "<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><br />Please go back, USERNAME is only allowed to have letters and numbers with NO SPACES MUST BE BETWEEN 5 to 10 characters.<p>&nbsp;</p><p>&nbsp;</p><a href='javascript:javascript:history.go(-1)'>Click here to go back to previous page</a>";

Open in new window

ASKER CERTIFIED SOLUTION
Tyler Laczko

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros