Checkboxes in PHP Mailer don't show

October 29, 2010 at 20:03:12
Specs: Windows 7
Hi. I know very little re: PHP, but, I need help with a form.

My problem is as follows: I have a form with multiple fields, dropdowns, and a set of checkboxes. I have a specific PHP mailer form, and, when it send the results to my account, it does not give me any info on the checkboxes; it only returns the value "Array".

Here is my PHP code:

<?PHP

$to = "site@keenerworks.com";
$subject = "Results from your Request Info form";
$headers = "From: ";
$forward = 0;
$location = "keenerworks.com/sample/tklagency/autoreturn.html";

$date = date ("l, F jS, Y");
$time = date ("h:i A");

$msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";

if ($_SERVER['REQUEST_METHOD'] == "POST") {
foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}
else {
foreach ($_GET as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}

}

mail($to, $subject, $msg, $headers);
if ($forward == 1) {
header ("Location:$location");
}
else {
echo "Thank you for submitting our form. We will get back to you as soon as possible.";
}


?>

Here is the checkbox HTML code:

<label>
<input type="checkbox" name="currentcoverage[]" class="form" value="bond" id="currentcoverage_0" />
Bond</label>
<br />
<label>
<input type="checkbox" name="currentcoverage[]" class="form" value="commercialauto" id="currentcoverage_1" />
Commercial Auto</label><br />
<label>
<input type="checkbox" name="currentcoverage[]" class="form" value="commercialliability" id="currentcoverage_2" />
Commercial Liability</label><br />
<label>
<input type="checkbox" name="currentcoverage[]" class="form" value="commercialproperty" id="currentcoverage_3" />
Commercial Property</label><br />
<label>
<input type="checkbox" name="currentcoverage[]" class="form" value="commercialumbrella" id="currentcoverage_4" />
Commercial Umbrella</label><br />
<label>
<input type="checkbox" name="currentcoverage[]" class="form" value="directorsandofficersliability" id="currentcoverage_5" />
Directors and Officers Liability</label><br />
<label>
<input type="checkbox" name="currentcoverage[]" class="form" value="disability" id="currentcoverage_6" />
Disability</label><br />
<label>
<input type="checkbox" name="currentcoverage[]" class="form" value="grouphealth" id="currentcoverage_7" />
Group Health</label><br />
<label>
<input type="checkbox" name="currentcoverage[]" class="form" value="grouplife" id="currentcoverage_8" />
Group Life</label><br />
<label>
<input type="checkbox" name="currentcoverage[]" class="form" value="professionalliabilty" id="currentcoverage_9" />
Professional Liability</label><br />
<label>
<input type="checkbox" name="currentcoverage[]" class="form" value="workerscompensation" id="currentcoverage_10" />
Workers' Compensation</label><br />
<label>
<input type="checkbox" name="currentcoverage[]" class="form" value="other" id="currentcoverage_11" />
Other</label>  <input size="20" name="othercoverage" />


Any help will be greatly appreciated.

Thanks,
MK


See More: Checkboxes in PHP Mailer dont show

Report •

#1
October 29, 2010 at 22:34:53
$msg .= (!is_array($value)) ? ucfirst($key) ." : ". $value . "\n" : ucfirst($key) ." : ". implode(", ",$value) . "\n";


Report •
Related Solutions


Ask Question