Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Special character detection on a form....

Status
Not open for further replies.

quan

Programmer
Oct 3, 2001
58
0
0
US
I am trying to detect if the user has entered any characters beside alpha numeric on a form.

This is what i have so far. I dump the form data field into a scalor called $field. Problem is that when I do type in alpha numeric it still thinks it is a special character. Any help is appreciated.

Code so far...


if ($username !~ /^ [a-zA-Z0-9_\-+ \t\/@%]+$/) {
&report_bad_input;
exit;


<i>Its okay to dream.....</i>
 
How about this?

if ($username !~ /^\w+$/) {
&report_bad_input;
exit;
}
 
What is an example of something you enter that your script reports as bad? If you want strictly alphanumeric then what raider posted is what you should use. Otherwise post an example of what isn't working.

jaa
 
Exactly, only want alph numeric input. I will give that a try. Thanks a million. <i>Its okay to dream.....</i>
 
Worked like a charm, thanks a mill... <i>Its okay to dream.....</i>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top