Hello everyone iam new to this forum iam creating a form in php where i want when a user select to check-box in form then the checkbox value will be submited to the admin below is my form coding in php
value is showing but only 1 value is showing even i have selected 3 checkboxes iam confused how to fetch value from foreach and show below in my table.
This is html form
<label for="website">Country</label>
<input name="country[]" type="checkbox" value="India" />India
<input name="country[]" type="checkbox" value="Australia" />Australia
<input name="country[]" type="checkbox" value="UK" />UK
This is php code for form
<?php
$to = "";
$Subject = "Testing Subject";
$name = $_REQUEST["name"];
$email = $_REQUEST["email"];
$website = $_REQUEST["website"];
$food = $_REQUEST["food"];
$drink = $_REQUEST["drink"];
$country = $_REQUEST["country"];
foreach ($country as $statename)
{
echo "$statename";
}
$comment = $_REQUEST["comment"];
echo $result = "<table>
<tr>
<td><strong>Contact Inforamtion</strong> </td>
<td> </td>
</tr>
<tr>
<td>Name</td>
<td>$name</td>
</tr>
<tr>
<td>Email</td>
<td>$email</td>
</tr>
<tr>
<td>Website</td>
<td>$website</td>
</tr>
<tr>
<td>Food</td>
<td>$food</td>
</tr>
<tr>
<td>Drink</td>
<td>$drink</td>
</tr>
<tr>
<td>Country</td>
<td>$test</td>
</tr>
<tr>
<td>Comments</td>
<td>$comment</td>
</tr>
</table>";
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "X-Priority: 3\n";
$headers .= "X-MSMail-Priority: Normal\n";
$headers .= "X-Mailer: php\n";
mail($to,$Subject,$result,$headers);
?>

