I have 4 checkbox, 4 text field and 1 text area in my form and i need to send this information to my email
i am getting only text field and text area information not checkbox value
can anyone help me on this
below is the code
in HTML
<input name="checkbox" type="checkbox" id="checkbox" value="I AM INTERESTED IN BEING A DISTRIBUTOR">
<input name="checkbox" type="checkbox" id="checkbox" value="I OWN A FLEET OF COMMERCIAL VEHICLES">
<input name="checkbox" type="checkbox" id="checkbox" value="I NEED A LOCAL SUPPLIER FOR MYGREENOIL">
<input name="checkbox" type="checkbox" id="checkbox" value="I HAVE A TECHNICAL QUESTION">
<input type="text" name="name" id="name">
<input type="text" name="address" id="address">
<input type="text" name="phonenumber" id="phonenumber">
<input type="text" name="emailaddress" id="emailaddress">
<textarea name="commentsorquestion" id="commentsorquestion" cols="45" rows="5"></textarea>
in php
<?php
$name = $_POST['name'];
$address = $_POST['address'];
$phonenumber = $_POST['phonenumber'];
$emailaddress = $_POST['emailaddress'];
$InquiryFor = $_POST['inquiryfor'];
$commentsorquestion = $_POST['commentsorquestion'];
$checkbox = $_POST['checkbox'];
foreach($_POST['checkbox'] as $value)
{
echo 'Checked: '.$value.'
';
}
$email_from = 'mymail@mydomain.com';
$email_subject = "From website inquiry form";
$email_body = "$checkbox \n\nContact Person:\t$name \n\nAddress:\t$address \nPhone Number:\t$phonenumber \nEmail Address:\t$emailaddress \nComments or Questions:\t$commentsorquestion\n\n\n".
$to = "mymail@mydomain.com";
//Send the email!
mail($to,$email_subject,$email_body);
//done. redirect to thank-you page.
header('Location: index.htm');
?>