Is it really a name?

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
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Is it really a name?

Post by hawleyjr »

OK, I'm doing some form validation and I would like to determine whether or not what the user entered is really their name.

I'm validating against the following:

no numeric characters
no special characters (except for ' and - (hypen) )
A-z is OK
letters such as Éáöň need to be allowed.

I'm stuck on letters that have accents and such on them. anyone?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you may need to check if the submitted data is already in html entity form, as I think (depending on page charset settings) Firefox will entity encode the characters, while IE may not.. I can't remember those details. Anyway, you may be able to check the binary for the extended ascii accent characters and/or use a regex to check against all standardized entities for the accented characters (would need to do the numeric, both unicode and charset specific, and letter combo forms)

it's a party...
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

lol, that was the response I didn't want...I'm thinking the easy way out of this is too just check for characters such as: !@#$%^&*(){}[]\|:;?/><,

agree?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it can get quite complicated when you want support for international names ;)
Post Reply