Small adjustment

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
oo7ml
Forum Newbie
Posts: 15
Joined: Sun Jun 17, 2007 4:30 pm

Small adjustment

Post by oo7ml »

I want to create some PHP validation for my Name input box on my form

For my Username input box, i have

Code: Select all

if (preg_match('/^[a-z0-9_]{5,20}$/i', $username))
This checks that the username is 5 - 20 characters in length and that a-z 0-9 _ characters are only used

How do i create a validation similar to above that only checks that the name input box is 1-20 characters in length (any characters can be used)

Thanks
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

.{1,20}
User avatar
Gente
Forum Contributor
Posts: 252
Joined: Wed Jun 13, 2007 9:43 am
Location: Ukraine, Kharkov
Contact:

Post by Gente »

User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

*cough* yes, that's better ;)
Post Reply