MDLarson
Registered
I have a monster HTML form located here:
http://www.stonemountainpetlodge.com/contact/registration_dog/email.html
The checkboxes in question are located a bit down on the page, and start with Daily Brush, Frosty Paws Treat, Morning Walk, etc. Each checkbox is coded in this manner:
When the form is submitted, it runs a PHP script (emailer.php) that looks like this:
Basically, when I don't have the [] brackets attached to the names of each checkbox on my form, I only get the last checkbox that was checked in my email. I need all of the items that are checked, not just one! In its current form, the only result I get in my email is "Array".
I have since added the [] brackets, and toyed around with the serialize / unserialize PHP functions, and can produce a result that looks like:
...but, I don't know how to make that useable. Any help would be awesome!
http://www.stonemountainpetlodge.com/contact/registration_dog/email.html
The checkboxes in question are located a bit down on the page, and start with Daily Brush, Frosty Paws Treat, Morning Walk, etc. Each checkbox is coded in this manner:
Code:
<input name="dog_1_services_basic_regular[]" type="checkbox" id="dog_1_services_basic_regular[]" value="Daily Brush">
Code:
<?php
// Variables from form input
$customer_id_number = $_POST['customer_id_number'];
$dropoff_date = $_POST['dropoff_date'];
$pickup_date = $_POST['pickup_date'];
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$email = $_POST['email'];
$daytime_phone = $_POST['daytime_phone'];
$evening_phone = $_POST['evening_phone'];
$mobile_phone = $_POST['mobile_phone'];
$doctor_name = $_POST['doctor_name'];
$clinic_name = $_POST['clinic_name'];
$clinic_phone = $_POST['clinic_phone'];
$dog_bitten = $_POST['dog_bitten'];
$lodging_plan = $_POST['lodging_plan'];
$dog_1_name = $_POST['dog_1_name'];
$dog_1_breed = $_POST['dog_1_breed'];
$dog_1_sex = $_POST['dog_1_sex'];
$dog_1_sterilized = $_POST['dog_1_sterilized'];
$dog_1_birthdate = $_POST['dog_1_birthdate'];
$dog_1_rabies_immunization_date = $_POST['dog_1_rabies_immunization_date'];
$dog_1_bordetella_immunization_date = $_POST['dog_1_bordetella_immunization_date'];
$dog_1_dhlpp_immunization_date = $_POST['dog_1_dhlpp_immunization_date'];
$dog_1_services_basic_regular = $_POST['dog_1_services_basic_regular'];
$dog_1_services_basic_peak = $_POST['dog_1_services_basic_peak'];
$dog_1_services_delights_regular = $_POST['dog_1_services_delights_regular'];
$dog_1_services_delights_peak = $_POST['dog_1_services_delights_peak'];
$dog_1_walk_or_exercise = $_POST['dog_1_walk_or_exercise'];
$dog_1_services_doggy_day_lodge = $_POST['dog_1_services_doggy_day_lodge'];
$dog_2_name = $_POST['dog_2_name'];
$dog_2_breed = $_POST['dog_2_breed'];
$dog_2_sex = $_POST['dog_2_sex'];
$dog_2_sterilized = $_POST['dog_2_sterilized'];
$dog_2_birthdate = $_POST['dog_2_birthdate'];
$dog_2_rabies_immunization_date = $_POST['dog_2_rabies_immunization_date'];
$dog_2_bordetella_immunization_date = $_POST['dog_2_bordetella_immunization_date'];
$dog_2_dhlpp_immunization_date = $_POST['dog_2_dhlpp_immunization_date'];
$dog_2_services_basic_regular = $_POST['dog_2_services_basic_regular'];
$dog_2_services_basic_peak = $_POST['dog_2_services_basic_peak'];
$dog_2_services_delights_regular = $_POST['dog_2_services_delights_regular'];
$dog_2_services_delights_peak = $_POST['dog_2_services_delights_peak'];
$dog_2_walk_or_exercise = $_POST['dog_2_walk_or_exercise'];
$dog_2_services_doggy_day_lodge = $_POST['dog_2_services_doggy_day_lodge'];
$dog_3_name = $_POST['dog_3_name'];
$dog_3_breed = $_POST['dog_3_breed'];
$dog_3_sex = $_POST['dog_3_sex'];
$dog_3_sterilized = $_POST['dog_3_sterilized'];
$dog_3_birthdate = $_POST['dog_3_birthdate'];
$dog_3_rabies_immunization_date = $_POST['dog_3_rabies_immunization_date'];
$dog_3_bordetella_immunization_date = $_POST['dog_3_bordetella_immunization_date'];
$dog_3_dhlpp_immunization_date = $_POST['dog_3_dhlpp_immunization_date'];
$dog_3_services_basic_regular = $_POST['dog_3_services_basic_regular'];
$dog_3_services_basic_peak = $_POST['dog_3_services_basic_peak'];
$dog_3_services_delights_regular = $_POST['dog_3_services_delights_regular'];
$dog_3_services_delights_peak = $_POST['dog_3_services_delights_peak'];
$dog_3_walk_or_exercise = $_POST['dog_3_walk_or_exercise'];
$dog_3_services_doggy_day_lodge = $_POST['dog_3_services_doggy_day_lodge'];
$message = $_POST['message'];
$agree_to_terms_and_conditions = $_POST['agree_to_terms_and_conditions'];
// Page URLs
$url_form = getenv("http_referer");
$url_error_empty_fields = "error_empty_fields.html";
$url_error_invalid_fields = "error_invalid_fields.html";
$url_unknown_error = "error_unknown.html";
$url_success = "thank_you.html";
// Check for errors (empty fields)
if (empty($dropoff_date) || empty($pickup_date) || empty($first_name) || empty($last_name) || empty($email) || empty($address) || empty($city) || empty($state) || empty($zip) || empty($dog_bitten) || empty($lodging_plan) || empty($agree_to_terms_and_conditions)) {
header("Location: $url_error_empty_fields");
exit ;
}
// Check for errors (invalid fields)
if ($dropoff_date == "MM/DD/YYYY" || $pickup_date == "MM/DD/YYYY") {
header("Location: $url_error_invalid_fields");
exit ;
}
// "Sender Name" <email@address.com>
$sender = "\"" . $first_name . " " . $last_name . "\" <" . $email . ">";
// Recipient of email
$recipient = "my_email_address@my_domain.com";
// Script variables
$subject = "Dog Registration; " . $dropoff_date . " to " . $pickup_date;
$headers = "From: " . $sender . "\r\n";
$headers .= "Reply-To: " . $sender . "\r\n";
$headers .= "Return-Path: " . $sender . "\r\n";
$headers .= "CC: " . "" . "\r\n";
$headers .= "BCC: " . "" . "\r\n";
$message =
"----------------------- Contact Info ------------------------\n" .
"Customer ID # " . $customer_id_number . "\n" .
"Owner Name " . $first_name . " " . $last_name . "\n" .
"Street Address " . $address . "\n" .
"City, State, Zip " . $city . ", " . $state . " " . $zip . "\n" .
"Email Address " . $email . "\n" .
"Daytime Phone # " . $daytime_phone . "\n" .
"Evening Phone # " . $evening_phone . "\n" .
"Mobile Phone # " . $mobile_phone . "\n" .
"\n" .
"------------------- Preferred Veternarian -------------------\n" .
"Doctor Name " . $doctor_name . "\n" .
"Clinic Name " . $clinic_name . "\n" .
"Clinic Phone # " . $clinic_phone . "\n" .
"Has dog bitten someone? " . $dog_bitten . "\n" .
"\n" .
"-------------------- Reservation Details --------------------\n" .
"Dog Stay " . $dropoff_date . " to " . $pickup_date . "\n" .
"Plan & Suite " . $lodging_plan . "\n" .
"Dog 1 Services, Basic " . $dog_1_services_basic_regular . "\n" .
"Dog 1 Services, Basic (Peak) " . $dog_1_services_basic_peak . "\n" .
"Dog 1 Services, Delights " . $dog_1_services_delights_regular . "\n" .
"Dog 1 Services, Delights (Peak) " . $dog_1_services_delights_peak . "\n" .
"Dog 1 Services, Doggy Day Lodge " . $dog_1_services_doggy_day_lodge . "\n" .
"Dog 2 Services, Basic " . $dog_2_services_basic_regular . "\n" .
"Dog 2 Services, Basic (Peak) " . $dog_2_services_basic_peak . "\n" .
"Dog 2 Services, Delights " . $dog_2_services_delights_regular . "\n" .
"Dog 2 Services, Delights (Peak) " . $dog_2_services_delights_peak . "\n" .
"Dog 2 Services, Doggy Day Lodge " . $dog_2_services_doggy_day_lodge . "\n" .
"Dog 3 Services, Basic " . $dog_3_services_basic_regular . "\n" .
"Dog 3 Services, Basic (Peak) " . $dog_3_services_basic_peak . "\n" .
"Dog 3 Services, Delights " . $dog_3_services_delights_regular . "\n" .
"Dog 3 Services, Delights (Peak) " . $dog_3_services_delights_peak . "\n" .
"Dog 3 Services, Doggy Day Lodge " . $dog_3_services_doggy_day_lodge . "\n" .
"\n" .
"--------------------------- Dog 1 ---------------------------\n" .
"Name " . $dog_1_name . "\n" .
"Breed " . $dog_1_breed . "\n" .
"Sex " . $dog_1_sex . "\n" .
"Sterilized " . $dog_1_sterilized . "\n" .
"Birth Date " . $dog_1_birthdate . "\n" .
"Rabies Immunization " . $dog_1_rabies_immunization_date . "\n" .
"Bordetella Immunization " . $dog_1_bordetella_immunization_date . "\n" .
"DHLPP Immunization " . $dog_1_dhlpp_immunization_date . "\n" .
"\n" .
"--------------------------- Dog 2 ---------------------------\n" .
"Name " . $dog_2_name . "\n" .
"Breed " . $dog_2_breed . "\n" .
"Sex " . $dog_2_sex . "\n" .
"Sterilized " . $dog_2_sterilized . "\n" .
"Birth Date " . $dog_2_birthdate . "\n" .
"Rabies Immunization " . $dog_2_rabies_immunization_date . "\n" .
"Bordetella Immunization " . $dog_2_bordetella_immunization_date . "\n" .
"DHLPP Immunization " . $dog_2_dhlpp_immunization_date . "\n" .
"\n" .
"--------------------------- Dog 3 ---------------------------\n" .
"Name " . $dog_3_name . "\n" .
"Breed " . $dog_3_breed . "\n" .
"Sex " . $dog_3_sex . "\n" .
"Sterilized " . $dog_3_sterilized . "\n" .
"Birth Date " . $dog_3_birthdate . "\n" .
"Rabies Immunization " . $dog_3_rabies_immunization_date . "\n" .
"Bordetella Immunization " . $dog_3_bordetella_immunization_date . "\n" .
"DHLPP Immunization " . $dog_3_dhlpp_immunization_date . "\n" .
"\n" .
"---------------- Comments & Additional Notes ----------------\n" .
$message . "\n" .
"\n" .
"----------------------- Miscellaneous -----------------------\n" .
"Agreed to terms? " . $agree_to_terms_and_conditions . "\n" .
"This message was sent from:\n" .
$url_form;
// Send email
if (mail($recipient,$subject,$message,$headers)){
header("Location: $url_success");
} else {
header("Location: $url_unknown_error");
}
?>
I have since added the [] brackets, and toyed around with the serialize / unserialize PHP functions, and can produce a result that looks like:
Code:
a:3:{i:0;s:11:"Daily Brush";i:1;s:14:"Afternoon Walk";i:2;s:11:"Medications";}