Ralph Freshour wrote:
I have some textfield that users will enter data into on my web site
and then I'll use php and write it to mysql - for security purposes,
is there a function or way to make sure that they only enter in alpha
and numeric data?
Thanks...
yes, check all the characters.
You can use a regular expression, or make your own little routine.
In case of a regex, ask somebody else. I never took the time to study them,
but know they are extremely powerfull once you get to know them.
In case of your own little routine:
just walk through the whole string and get a character at a time.
Check if the character is in a string with 'acceptable characters'
AcceptableCharacters = "abcdefghijklmnopqrstuvwxyz _1234567890-";
use strlen to get the length of any string.
use strrpos to find an occurence of any string in another string. It returns
false when not found.
use substr to get a character (or more) out of a string.
You'll have to code the rest. :-)
Good luck,
Erwin