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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New to the GGI World - Form Input Validation

Status
Not open for further replies.

crm2k

Technical User
May 31, 2005
1
US
Hey Everyone,

I need some help here. I am trying to edit my company's current cgi script so that not only the email is validated but the name of the submitter is to. The cgi doesnt have the funtion built in to let me create a hidden form field with a "required" attribute. Here is a link to the script and my form.



Thanks for the help,

Chris
 
I'm not sure what you're looking to validate the name against, but if it's just to see if someone has put in two words, try the following before the [b/if($found_err){[/b] line:

Code:
if ($name !~ /\w+\s\w+/) {
	$message = $message.$errmsg ;
	$found_err = 1 ; }

Broken out, this is:
Code:
if ($name !~/ #name is not match
          \w+ #a word character(A-Z_a-z0-9) one or more times
          \s  #a space character
          \w+ #a word character(A-Z_a-z0-9) one or more times
          /) { #end RegExp

Again, not sure if that's what you're looking for, but it's a good start for you.

- Rieekan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top