How To Send CHECK BOX data from a FORM to EMAIL
Posted: Tue Aug 31, 2010 2:58 am
hello
I have created this QUOTATION form but i m not receiving the date from CHECK BOXES in the email. Can anyone Help?
HTML is as follows
<form action="php/quotation.php" method="post" name="quotation_form">
<label for="Name">Name:</label>
<input name="Name" type="text" size="30" />
<label for="Company">Company:</label>
<input name="Company" type="text" size="30" />
<label for="Phone">Phone:</label>
<input name="Phone" type="text" size="30" />
<label for="Fax">Fax:</label>
<input name="Fax" type="text" size="30" />
<label for="Email">Email:</label>
<input name="Email" type="text" size="30" />
<label for="Web">Web:</label>
<input name="Web" type="text" size="30" />
<label for="Inquiry">Inquiry Items:</label><br />
<input type="checkbox" name="Inquiry[]" value="greige" class="checkbox"> Greige Fabric
<input type="checkbox" name="Inquiry[]" value="finished" class="checkbox"> Finished Fabric
<input type="checkbox" name="Inquiry[]" value="home" class="checkbox"> Home Textiles
<input type="checkbox" name="Inquiry[]" value="garments" class="checkbox"> Garments <br />
<label for="Quantity">Quantity:</label>
<input name="Quantity" type="text" size="10" />
<label for="Terms">Terms:</label>
<input name="Terms" type="text" size="30" />
<label for="Port">Port:</label>
<input name="Port" type="text" size="30" />
<label for="Message">Message:</label><br />
<textarea name="Message" cols="40" rows="10"></textarea>
<input type="submit" name="submit" value="Submit" class="submit-button" />
<input type="reset" name="reset" value="Reset" class="submit-button" onClick="document.quotation_form.reset();return false" />
</form>
And PHP Code is as follows
<?php
$EmailTo = "luckytextile@luckytextilemills.biz";
$Subject = "Quotation From Website";
$Name = Trim(stripslashes($_POST['Name']));
$Company = Trim(stripslashes($_POST['Company']));
$Phone = Trim(stripslashes($_POST['Phone']));
$Fax = Trim(stripslashes($_POST['Fax']));
$Email = Trim(stripslashes($_POST['Email']));
$Web = Trim(stripslashes($_POST['Web']));
$Inquiry = Trim(stripslashes($_POST['Inquiry']));
$Quantity = Trim(stripslashes($_POST['Quantity']));
$Terms = Trim(stripslashes($_POST['Terms']));
$Port = Trim(stripslashes($_POST['Port']));
$Message = Trim(stripslashes($_POST['Message']));
// validation
$validationOK=true;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Company Name: ";
$Body .= $Company;
$Body .= "\n";
$Body .= "Phone: ";
$Body .= $Phone;
$Body .= "\n";
$Body .= "Fax: ";
$Body .= $Fax;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Web: ";
$Body .= $Web;
$Body .= "\n";
$Body .= "Inquired Items:";
$Body .= $Inquiry;
$Body .= "\n";
$Body .= "Quantity: ";
$Body .= $Quantity;
$Body .= "\n";
$Body .= "Terms: ";
$Body .= $Terms;
$Body .= "\n";
$Body .= "Port: ";
$Body .= $Port;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$Email>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=../thanks.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=../error.html\">";
}
?>
Thanks
I have created this QUOTATION form but i m not receiving the date from CHECK BOXES in the email. Can anyone Help?
HTML is as follows
<form action="php/quotation.php" method="post" name="quotation_form">
<label for="Name">Name:</label>
<input name="Name" type="text" size="30" />
<label for="Company">Company:</label>
<input name="Company" type="text" size="30" />
<label for="Phone">Phone:</label>
<input name="Phone" type="text" size="30" />
<label for="Fax">Fax:</label>
<input name="Fax" type="text" size="30" />
<label for="Email">Email:</label>
<input name="Email" type="text" size="30" />
<label for="Web">Web:</label>
<input name="Web" type="text" size="30" />
<label for="Inquiry">Inquiry Items:</label><br />
<input type="checkbox" name="Inquiry[]" value="greige" class="checkbox"> Greige Fabric
<input type="checkbox" name="Inquiry[]" value="finished" class="checkbox"> Finished Fabric
<input type="checkbox" name="Inquiry[]" value="home" class="checkbox"> Home Textiles
<input type="checkbox" name="Inquiry[]" value="garments" class="checkbox"> Garments <br />
<label for="Quantity">Quantity:</label>
<input name="Quantity" type="text" size="10" />
<label for="Terms">Terms:</label>
<input name="Terms" type="text" size="30" />
<label for="Port">Port:</label>
<input name="Port" type="text" size="30" />
<label for="Message">Message:</label><br />
<textarea name="Message" cols="40" rows="10"></textarea>
<input type="submit" name="submit" value="Submit" class="submit-button" />
<input type="reset" name="reset" value="Reset" class="submit-button" onClick="document.quotation_form.reset();return false" />
</form>
And PHP Code is as follows
<?php
$EmailTo = "luckytextile@luckytextilemills.biz";
$Subject = "Quotation From Website";
$Name = Trim(stripslashes($_POST['Name']));
$Company = Trim(stripslashes($_POST['Company']));
$Phone = Trim(stripslashes($_POST['Phone']));
$Fax = Trim(stripslashes($_POST['Fax']));
$Email = Trim(stripslashes($_POST['Email']));
$Web = Trim(stripslashes($_POST['Web']));
$Inquiry = Trim(stripslashes($_POST['Inquiry']));
$Quantity = Trim(stripslashes($_POST['Quantity']));
$Terms = Trim(stripslashes($_POST['Terms']));
$Port = Trim(stripslashes($_POST['Port']));
$Message = Trim(stripslashes($_POST['Message']));
// validation
$validationOK=true;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Company Name: ";
$Body .= $Company;
$Body .= "\n";
$Body .= "Phone: ";
$Body .= $Phone;
$Body .= "\n";
$Body .= "Fax: ";
$Body .= $Fax;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Web: ";
$Body .= $Web;
$Body .= "\n";
$Body .= "Inquired Items:";
$Body .= $Inquiry;
$Body .= "\n";
$Body .= "Quantity: ";
$Body .= $Quantity;
$Body .= "\n";
$Body .= "Terms: ";
$Body .= $Terms;
$Body .= "\n";
$Body .= "Port: ";
$Body .= $Port;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$Email>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=../thanks.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=../error.html\">";
}
?>
Thanks