Is this correct?

"; print "

There are some errors with your form submission.

"; print ""; print ""; } } function validateform() { global $errors; if (!isset($_POST['first']) || trim($_POST['first']) == '') { $errors['first'] = "First name is required."; } if (!isset($_POST['last']) || trim($_POST['last']) == '') { $errors['last'] = "Last name is required."; } if (!isset($_POST['email']) || trim($_POST['email']) == '') { $errors['email'] = "Email is required."; } else { //email is set, let's validate to see if it's //the correct string type. if (!eregi("^[_a-z0-9]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", trim($_POST['email']))) { $errors['emailv'] = "Email address is not valid."; } } //if one of the phone fields is filled, then all //of them must be filled. if ( (isset($_POST['areacode']) && (trim($_POST['areacode']) != '')) || ( isset($_POST['trunk']) && (trim($_POST['trunk']) != '')) || ( isset($_POST['pnumber']) && (trim($_POST['pnumber']) != ''))) { if ((trim($_POST['areacode']) == '') || (trim($_POST['trunk']) == '' ) || (trim($_POST['pnumber']) == '')) { $errors['phone'] = "All components of phone number must be provided"; } else { if ( (!ctype_digit(trim($_POST['areacode']))) ||(!ctype_digit(trim($_POST['trunk']))) ||(!ctype_digit(trim($_POST['pnumber'])))) { $errors['phone2'] = "Phone number must be numeric"; } } } //if one of the address field is filled, then all of //them must be filled (with the exception of aptnum). if ( (isset($_POST['street']) && (trim($_POST['street']) != '')) || ( isset($_POST['aptnum']) && (trim($_POST['aptnum']) != '')) || ( isset($_POST['city']) && (trim($_POST['city']) != '')) || ( isset($_POST['state']) && (trim($_POST['state']) != '')) || ( isset($_POST['zip']) && (trim($_POST['zip']) != ''))) { if ((trim($_POST['street']) == '') || (trim($_POST['city']) == '' ) || (trim($_POST['state']) == '' ) || (trim($_POST['zip']) == '' )) { $errors['address'] = "Address fields are not all filled"; return; } else { //address fields are all filled if (!ctype_digit(trim($_POST['zip']))) { $errors['zip'] = "Zip code must be numeric"; } if (!ctype_alpha(trim($_POST['state']))) { $errors['state'] = "State should be alphabetic"; } } } } //EXECUTION BLOCK ?> Sunnyvale Hindu Temple and Community Center, South Bay


Add to Mailing List
*************************
   
Home
About
Activities
Festivals
Services
Donations
Preeti Bhoj
Links
Volunteer
Sitemap
   
   
   
 

Fields marked with an asterisk (*) are required.

First Name*:
Last Name*:
Email*:
Phone: ( ) -
 
If an address is provided, a complete address must be provided.
 
Street Address:
Apt./Suite Number:
City
State
Zip