";
echo $error."
";
echo "Please go back and fix these errors.
";
die();
}
// validation expected data exists
if(!isset($_POST['first_name']) ||
!isset($_POST['last_name']) ||
!isset($_POST['date_of_birth']) ||
!isset($_POST['address']) ||
!isset($_POST['email']) ||
!isset($_POST['telephone']) ||
!isset($_POST['do_you_live_alone?']) ||
!isset($_POST['do_you_have_transporation?']) ||
!isset($_POST['do_you_have_a_caregiver?']) ||
!isset($_POST['caregiver_name ']) ||
!isset($_POST['caregiver_telephone']) ||
!isset($_POST['caregiver_email']) ||
!isset($_POST['improve_quality_of_life']) ||
!isset($_POST['improve_health-_mind_body_&_soul']) ||
!isset($_POST['fitness_for_sports_&_recreation']) ||
!isset($_POST['paralympic_sports_programs']) ||
!isset($_POST['all_of_the_above']) ||
!isset($_POST['i_agree']) ||
!isset($_POST['comments'])) {
died('We are sorry, but there appears to be a problem with the form you submitted.');
}
$first_name = $_POST['first_name']; // required
$last_name = $_POST['last_name']; // required
$date_of_birth = $_POST['date_of_birth']; // required
$address = $_POST['address']; // required
$email_from = $_POST['email']; // required
$telephone = $_POST['telephone']; // not required
$do_you_live_alone = $_POST['do_you_live_alone']; // not required
$do_you_have_transportation = $_POST['do_you_have_transportation']; // required
$do_you_have_a_caregiver = $_POST['do_you_have_a_caregiver']; // not required
$caregiver_name = $_POST['caregiver_name']; // not required
$caregiver_telephone = $_POST['caregiver_telephone']; // not required
$caregiver_email = $_POST['caregiver_email']; // not required
$improve_quality_of_life = $_POST['improve_quality_of_life']; // not required
$improve_health_mind_body_soul = $_POST['improve_health_mind_body_&_soul']; // not required
$fitness_for_sports_recreation = $_POST['fitness_for_sports_&_recreation']; // not required
$paralympic_sports_programs = $_POST['paralympic_sports_programs']; // not required
$all_of_the_above = $_POST['all_of_the_above']; // not required
$i_agree = $_POST['i_agree']; // required
$comments = $_POST['comments']; // not required
$error_message = "";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
if(!preg_match($email_exp,$email_from)) {
$error_message .= 'The Email Address you entered does not appear to be valid.
';
}
$string_exp = "/^[A-Za-z .'-]+$/";
if(!preg_match($string_exp,$first_name)) {
$error_message .= 'The First Name you entered does not appear to be valid.
';
}
if(!preg_match($string_exp,$last_name)) {
$error_message .= 'The Last Name you entered does not appear to be valid.
';
}
if(!preg_match($string_exp,$date_of_birth)) {
$error_message .= 'Please enter your date of birth.
';
}
if(!preg_match($string_exp,$address)) {
$error_message .= 'Please enter your address.
';
}
if(!preg_match($string_exp,$email)) {
$error_message .= 'Please enter a valid email.
';
}
if(!preg_match($string_exp,$do_you_have_transportation)) {
$error_message .= 'Please let us know if you have transportation.
';
}
if(!preg_match($string_exp,$i_agree)) {
$error_message .= 'You must agree to allow us to contact you for further information.
';
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = "Form details below.\n\n";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "First Name: ".clean_string($first_name)."\n";
$email_message .= "Last Name: ".clean_string($last_name)."\n";
$email_message .= "Date of Birth: ".clean_string($date_of_birth)."\n";
$email_message .= "Address: ".clean_string($address)."\n";
$email_message .= "Email: ".clean_string($email_from)."\n";
$email_message .= "Telephone: ".clean_string($telephone)."\n";
$email_message .= "Do You Live Alone: ".clean_string($do_you_live_alone)."\n";
$email_message .= "Do You Have Transportation: ".clean_string($do_you_have_transportation)."\n";
$email_message .= "Do You Have A Caregiver: ".clean_string($do_you_have_a_caregiver)."\n";
$email_message .= "Caregiver Name: ".clean_string($caregiver_name)."\n";
$email_message .= "Caregiver Telephone: ".clean_string($caregiver_telephone)."\n";
$email_message .= "Caregiver Email: ".clean_string($caregiver_email)."\n";
$email_message .= "Improve Quality Of Life: ".clean_string($improve_quality_of_life)."\n";
$email_message .= "Improve Health-Mind, Body & Soul: ".clean_string($improve_health-_mind_body_&_soul)."\n";
$email_message .= "Fitness For Sports & Recreation: ".clean_string($fitness_for_sports_&_recreation)."\n";
$email_message .= "Paralympic Sport Programs: ".clean_string($paralympic_sports_programs)."\n";
$email_message .= "All Of The Above: ".clean_string($all_of_the_above)."\n";
$email_message .= "I Agree: ".clean_string($i_agree)."\n";
$email_message .= "Comments: ".clean_string($comments)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>
Thank you for contacting us. We will be in touch with you very soon.