#for checking the form
$form_vars=array(
array('c_first_name', 'First Name'),
array('c_last_name', 'Last Name'),
array('c_phone', 'Phone'),
array('c_email', 'Email'),
array('c_address_1', 'Address'),
array('c_city', 'City'),
array('c_state', 'State'),
array('c_zip', 'Zip'),
array('c_email', 'Email'),
);
if (isset($_REQUEST['volunteer_category'])){
$form_errors = array();
#flag form errors with a 'red' css class
foreach ($form_vars as $line) {
list ($field, $desc) = $line;
if (!isset($_REQUEST[$field]) || $_REQUEST[$field] == '') {
$form_errors[$field] = 'class = "red"';
}
}
#if(!checkEmail($c_email)) $form_errors["c_email"] = 1;
# special handling since all teh categories share one error
# make the error default...
$form_errors['cat_list'] = 'class = "red"';
# ...then clear it if a category is checked
foreach ($volunteer_categories as $cat) {
if (isset($_REQUEST[$cat[0]])) {
unset($form_errors['cat_list'] );
break;
}
}
if(count($form_errors) == 0){
$c_first_name = jf3_format($_REQUEST['c_first_name']);
$c_last_name = jf3_format($_REQUEST['c_last_name']);
$c_phone = jf3_format($_REQUEST['c_phone']);
$c_email = jf3_format($_REQUEST['c_email']);
//$other = jf3_format($other);
$mail_to = 'david@pashdown.org,justin@pashdown.org,pashdown@xmission.com,mary@pashdown.org,jeff@pashdown.org';
$mail_subj = 'Volunteer: '.$c_first_name.' '.$c_last_name;
$mail_from = 'volunteer-form@pashdown.org';
$mail_body = '
FIRST NAME: '.$c_first_name.'
LAST NAME: '.$c_last_name.'
PHONE: '.$c_phone.'
EMAIL: '.$c_email.'
ADDRESS: '.$_REQUEST['c_address_1'].'
'.$_REQUEST['c_address_2'].'
CITY: '.$_REQUEST['c_city'].'
STATE: '.$_REQUEST['c_state'].'
ZIP: '.$_REQUEST['c_zip'].'
CATEGORIES:
';
// append form input here.
foreach ($volunteer_categories as $row) {
if (isset($_REQUEST[$row[0]])) {
$mail_body .= $row[1]."\n";
}
}
if (isset($_REQUEST['other'])) {
$mail_body .= $_REQUEST['other_value'];
}
$headers = 'From: '.$mail_from.' <'.$mail_from.'>'."\n";
$mailsuccess = mail($mail_to, $mail_subj, $mail_body, $headers);
if(count($cat_list) > 0) $records_added++;
if($mailsuccess > 0){
?>
THANK YOU for volunteering!
|
}else{
$msg = 'There was a problem processing your submission.';
}
}else{
$msg = 'There was a problem with the information you entered. Please check your entries and try again. Improperly completed fields have been marked in red.';
}
}
if(!$mailsuccess){
?>
'.$msg.'
'?>
Complete the form below to register as a volunteer or request campaign materials. All name and contact fields are required.
|
} # end the foreach loop
?>
|