I want to create some PHP validation for my Name input box on my form For my Username input box, i have if (preg_match('/^[a-z0-9_]{5,20}$/i', $username)) PHP: 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
Hmm, short of adding all the characters aI'm not too sure. You could always use strlen instread if ((strlen($username)>=1) AND (strlen($username)<=20)) { Validate } else { error } etc.