So the problem I am having is probably easy to solve, I'm just not great with coding yet. I did some research and I can't find anything that will work with what I have set up. Anyway, I have between 3-6 check boxes an *the check boxes would be "Food"* It is set up as an array in the HTML Form name="Food[]". The problem is that I cannot get the value of the checked box to show up in the email. It will either show up blank "Food: " or it will show up as "Food: Array" I cannot seem to figure out why I can't get the value to show up.
Any help would be appreciative.PHP Code:<?php
$to = "email@internet" ;
$from = $_REQUEST['Email'] ;
$name = $_REQUEST['Name'] ;
$headers = "From: $from";
$subject = "NEW SUBJECT";
$Food = $_POST["Food"];
$fields = array();
$fields{"Name"} = "Name";
$fields{"Company"} = "Company";
$fields{"Email"} = "Email";
$fields{"Phone"} = "Phone";
$fields{"$Food"} = "FOOD";
$fields{"Other"} = "Other";
$fields{"Description"} = "Description";
$body = "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$headers2 = "From: email@internet.com";
$subject2 = "Thank you for contacting us";
$autoreply = "Thank you for contacting us. Somebody will get back to you as soon as possible, usualy within 48 hours. If you have any more questions, please consult our website at www.website.com";
if($from == '') {print "You have not entered an email, please go back and try again";}
else {
if($name == '') {print "You have not entered a name, please go back and try again";}
else {
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
if($send)
{header( "Location: http://www.website.com" );}
else
{print "We encountered an error sending your mail, please notify webmaster@YourCompany.com"; }
}
}
?>
Thanks in advance



Reply With Quote

Bookmarks