Freddyto13
New Member
I have a field where user input their age, and I want to do some error checking. If the user enter the digit '0' and click \[code\]submit\[/code\], it will display an error saying they can't begin with a zero. But I also want to allow an age that contain the digit zero, such as age 20. I don't know how to not allow someone to enter a beginning digit of 0. My PHP code is:\[code\]<?php$age_numeric = preg_match("/^(^[1-9]){1,}$/", $age);?>//some more code<?php if (!$age_numeric) echo "age can only be numeric."; ?>\[/code\]