I have designed a form template that uses an include() to add a color checkbox array for a specific carpet line.
My problem is that when the email comes, the $colors field only shows "Array". I know there needs to be some coding to allow the $colors to show all colors selected. Can you point me in the right direction? I know I'm missing something; still a advanced-noob at php.
Link to project:[URL=http://]http://www.gndzero.com/sample_test_main.html[/URL]
Here is the email processing code:
<?php
if($submitform) {
$name = $HTTP_POST_VARS['name'];
$email = $HTTP_POST_VARS['email'];
$colors = $HTTP_POST_VARS['colors'];
$comments = $HTTP_POST_VARS['quote'];
// check required fields
$dcheck = explode(",",$require);
while(list($check) = each($dcheck)) {
if(!$$dcheck[$check]) {
$error .= "Missing $dcheck[$check]<br>";
}
}
// check email address
if ((!ereg(".+\@.+\..+", $Email)) || (!ereg("^[a-zA-Z0-9_@.-]+$", $Email))){
$error .= "Invalid email address<br>";}
// display errors
if($error) {
?>
<b>Error</b><br>
<?php echo $error; ?><br>
<a href="#" onClick="history.go(-1)">try again</a>
<?php
}
else
{
$browser = $HTTP_USER_AGENT;
$ip = $REMOTE_ADDR;
// format message
$message = "Quote Form Information:
Project Information:
Item: $item
Name: $Name
Email: $Email
Company Name: $company
Industry: $industry
Facility: $facility
Square Feet of Facility: $sqft
Estimated Date of Project: $date
Colors: $colors
Comments: $quote
-----------------------------
Contact Information:
Phone Number: $phone
Fax Number: $fax
Address: $address
Address2: $address2
City: $city
State/Providence: $state
Zip/Postal Code: $zip
Country: $country
-----------------------------
";
// send mail and print success message
$hurrah = mail($toemail,"$subject","$message","From: $Name <$Email>");
if($hurrah) {
if($autoresponse == "no") {
$autosubject = stripslashes($autosubject);
$autocontact = stripslashes ($Name);
$automessage = stripslashes($automessage);
mail($Email,"$autosubject", "$autocontact","$automessage","From: $recipientname <$recipientemail>");
}
echo "$thanks";
}
}
}
else {
?>
This is the zscolors.php include():
<input type="hidden" name="colors" value="0">
<input type="checkbox" name="colors[0]" value="red" />
ZS-red
<br>
<input type="checkbox" name="colors[1]" value="yellow" />
ZS-yellow