Avatar of genesisvh
genesisvh

asked on 

Function to check username without spaces

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

PHP

Avatar of undefined
Last Comment
genesisvh
SOLUTION
Avatar of Tyler Laczko
Tyler Laczko
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Tyler Laczko
Tyler Laczko
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of genesisvh
genesisvh

ASKER

I'm getting this as an error: Warning: eregi() [function.eregi]: REG_ERANGE
SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of genesisvh
genesisvh

ASKER

I'm sorry to split the points but I'm still getting errors. I'm going to post the entire script and maybe take a look at the problem. Thanks!
PHP
PHP

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo