Help in coding

I am coding for a registration page and in the name field i want to return a false value if the user enters a numeric term. this will ensure it will be only alphabets, but i dont know how to do this. Please provide me with a solution and hopefully the code.

Hi there,

Your best bet is probably to do a simple regular expression.


echo (preg_match("/[a-zA-Z\s]/",$_POST[‘name’])) ? “this contains letters and spaces only” : “this contains numbers and/or other disallowed characters”;


Let me know if you have problems with this - I haven’t actually tested it, but it works in my head :smiley:

Sponsor our Newsletter | Privacy Policy | Terms of Service