default value (the default value counts as a missing field) $requiredfields = array('f_name' => 'FIRST NAME', 'l_name' => 'LAST NAME', 'region' => '', 'address1' => 'ADDRESS 1', 'city' => 'CITY', 'state' => 'STATE/PROVINCE', 'zip' => 'ZIP/POST CODE', 'country' => '', 'phone' => 'PHONE NUMBER', 'email' => 'EMAIL ADDRESS', 'school' => 'SCHOOL', 'schooladdress1' => 'ADDRESS 1', 'schoolcity' => 'CITY', 'schoolstate' => 'STATE/PROVINCE', 'schoolzip' => 'ZIP/POST CODE', 'schoolcountry' => '', 'heardfrom' => '' ); // plain english names of the required fields -- for error messages $requirednames = array('f_name' => 'First Name', 'l_name' => 'Last Name', 'region' => 'Region', 'address1' => 'Address 1', 'city' => 'City', 'state' => 'State/Province', 'zip' => 'Zip/Post Code', 'country' => 'Country', 'phone' => 'Phone Number', 'email' => 'Email Address', 'school' => 'School', 'schooladdress1' => 'School Address 1', 'schoolcity' => 'School City', 'schoolstate' => 'School State/Province', 'schoolzip' => 'School Zip/Post Code', 'schoolcountry' => 'School Country', 'heardfrom' => 'How did you hear about the contest?' ); // to check for email addresses $emailpattern = '^(mailto:)?[-!#$%&\'*+\\./0-9A-Z^_`a-z{|}~]+'. '@'. '([-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.)+' . '[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+$'; // check for required fields foreach($requiredfields as $f => $val) { if(!isset($_POST[$f]) || $_POST[$f] == $val) { $errors[] = 'Please enter: '.$requirednames[$f]; } else { if($f == 'heardfrom' && $val == 'other' && $_POST['heard_from_other'] == '') $errors[] = 'Please tell us how you heard about the contest.'; } } // valid email if(isset($_POST['email']) && $_POST['email'] != 'EMAIL ADDRESS' && !ereg($emailpattern, stripslashes($_POST['email']))) { $errors[] = 'Please enter a valid email address (only one please).'; } else { $matches = array(); // the there's a mailto:, remove it if(preg_match('/^mailto:(.+)/', $_POST['email'], $matches)) { $edit['email'] = $matches[1]; $_POST['email'] = $matches[1]; } } // valid teacher email if(isset($_POST['teacheremail']) && ($_POST['teacheremail'] != 'TEACHER EMAIL ADDRESS' && $_POST['teacheremail'] != '') && !ereg($emailpattern, stripslashes($_POST['teacheremail']))) { $errors[] = 'Please enter a valid teacher\'s email address (only one please).'; } else { $matches = array(); // if there's a mailto:, remove it if(preg_match('/^mailto:(.+)/', $_POST['teacheremail'], $matches)) $edit['teacheremail'] = $matches[1]; } // reformat the graduation date from MM-DD-YYYY to the system-accepted YYYY-MM-DD if(isset($_POST['graduationdate']) && ($_POST['graduationdate'] != 'GRADUATION DATE' && $_POST['graduationdate'] != '')) { $graddate = stripslashes($_POST['graduationdate']); $gradpattern = '/^([0-9]{2})-([0-9]{2})-([0-9]{4})$/'; $gooddate = false; if(preg_match('/^([0-9]{2})-([0-9]{2})-([0-9]{4})$/', $graddate)) { $newdate = $graddate; $gooddate = true; } else if(preg_match('/^([0-9]{2})-([0-9]{2})-([0-9]{2})$/', $graddate, $matches)) { $newdate = $matches[1].'-'.$matches[2].'-20'.$matches[3]; $gooddate = true; } else if(preg_match('/^([0-9]{1,2})[-\/\. ]([0-9]{1,2})[-\/\. ]([0-9]{2,4})$/', $graddate, $matches)) { $newdate = ($matches[1] < 10 ? '0'.($matches[1]%10) : $matches[1]).'-'.($matches[2] < 10 ? '0'.($matches[2]%10) : $matches[2]).'-20'.($matches[3]%100 < 10 ? '0'.$matches[3]%100 : $matches[3]%100); $gooddate = true; } else { $newdate = $graddate; } if($gooddate) { $_POST['graduationdate'] = $newdate; $edit['graduationdate'] = $newdate; } else { $errors[] = 'Please enter your graduation date in MM-DD-YYYY format.'; } } // if there are no errors, put together the query string and submit it if(count($errors) == 0) { $defaults = array('f_name' => 'FIRST NAME', 'l_name' => 'LAST NAME', 'address1' => 'ADDRESS 1', 'address2' => 'ADDRESS 2', 'address3' => 'ADDRESS 3', 'city' => 'CITY', 'state' => 'STATE/PROVINCE', 'zip' => 'ZIP/POST CODE', 'phone' => 'PHONE NUMBER', 'email' => 'EMAIL ADDRESS', 'school' => 'SCHOOL', 'schooladdress1' => 'ADDRESS 1', 'schooladdress2' => 'ADDRESS 2', 'schooladdress3' => 'ADDRESS 3', 'schoolcity' => 'CITY', 'schoolstate' => 'STATE/PROVINCE', 'schoolzip' => 'ZIP/POST CODE', 'major' => 'MAJOR', 'graduationdate' => 'GRADUATION DATE', 'teachername' => 'TEACHER NAME', 'teacheremail' => 'TEACHER EMAIL ADDRESS', 'teacherphone' => 'TEACHER TELEPHONE', ); $querystring = ''; foreach($_POST as $key => $value) { if(isset($defaults[$key]) && $value == $defaults[$key]) $value = ''; if($key != 'submit') $querystring .= ", $key = '".mysql_escape_string($value)."'"; } $querystring = "insert into registration set registration_date = now() , ".substr($querystring,1); //$querystring = "insert into registration set ".substr($querystring,1); mysql_query($querystring); // die($querystring); $id = mysql_insert_id(); $reg_id = $_POST['region'].$id; // if the registration succeceded, update the reg_id and forward them to the thanks page if($id) { $query = "update registration set reg_id='$reg_id' where id='$id'"; mysql_query($query); header("Location: regthanks.html?reg_id=$reg_id"); } else { // if reg failed, send email to sean $errormsg = '
We\'re sorry, there was an error processing your submission. The tech staff has been notified, and we will address the problem as soon as we can. Thank you for your patience.
'; // mail all info to sean@wiremedia.net $headers = "MIME-Version: 1.0\r \n"; $headers .= "Content-type: text/plain; charset=utf-8\r \n"; $headers .= "From: \"Infurmation.com\" \r \n"; $headers .= "Reply-To: \"Infurmation.com\" \r \n"; $subject = "DAF 2008 reg problem"; $theemail = "There was a problem with the infurmation registration:\n\nThe query:\n\n".$query; $sent = mail('sean@wiremedia.net', $subject, $theemail, $headers); // if(!$sent) die('Mail error'); } } else { $errormsg = '
Please correct the following errors:
    '; foreach($errors as $e) { $errormsg .= '
  • '.$e.'
  • '; } $errormsg .= '
'; } } ?> Fur Free Alliance - Information About Use of Fur Bearing Animals for Fur
Online Registration Form
Deadline for Registration: See chart for your region or country. Note: China students cannot register using this form. To register in the Chinese round, please visit DAFChina.com.
  1. To enter the Design Against Fur 2008 competition, please complete the following form.
  2. All required fields must be completed for your registration to be accepted.
  3. If you would like a copy of your completed form, please print this page before clicking the "Submit" button.

Your unique registration number will be generated upon completion of this form. Please make a note of this number for your records.

Fields marked with a * are required.


' size='50'>*
' size='50'>*


Please specify the 2008 Regional Competition in which you will be participating (Note: To register for DAF China, visit DAFChina.com):


Other group members
Please list them in this format: Lastname Firstname; Lastname Firstname:


' size='50'>*
' size='50'>
' size='50'>
' size='50'>*
' size='50'>*
' size='20'>* *


' size='50'>*


Please enter only one email address
' size='50'>*


' size='50'>*


' size='50'>*
' size='50'>
' size='50'>
' size='50'>*
' size='50'>*
' size='20'> * *


' size='50'>


Please write the date in this format: MM-DD-YYYY
' size='50'>


' size='50'>


' size='50'>


' size='50'>


>School
>Other: