rlgriffo
07-18-2008, 05:27 AM
Hi,
I have 2 sets of check boxes on my online form, I cant get either to display in the resulting email...i know im doing something wrong, i just dont know what. It has a php & html part so I will put them here and hopefully someone can point me in the right direction....
Thank you very much in advance!!
************************************************** ****
HTML SIDE
************************************************** ****
<form method="post" action="testmailer.php">
<input type="hidden" name="sub" value="1">
<table border="0">
<tr>
<td colspan="6"> </td>
</tr>
<tr>
<td colspan="6"><span style="font-weight: bold">What colour do you like?</span></td>
</tr>
<tr>
<td>blue</td>
<td id="checkbox"><input type="checkbox" name="check[]" value="blue" id="blue" /></td>
<td>red</td>
<td id="checkbox"><input type="checkbox" name="check[]" value="red" id="red" /></td>
<td id="name">yellow</td>
<td id="checkbox"><input type="checkbox" name="check[]" value="yellow" id="yellow" /></td>
</tr>
<tr>
<td colspan="6"><span style="font-weight: bold">What size would you like?</span></td>
</tr>
<tr>
<td>large</td>
<td><input type="checkbox" name="check[]" value="large" id="large" /></td>
<td>medium</td>
<td><input type="checkbox" name="check[]" value="medium" id="medium" /></td>
<td>small</td>
<td><input type="checkbox" name="check[]" value="small" id="small" /></td>
</tr>
<tr>
<td colspan="2"> </td>
<td colspan="2"> </td>
<td colspan="2"><label>
<input name="submit" type="submit" rows="9" value="submit" columns=50 id="submit">
</label></td>
</tr>
</table>
</form>
************************************************** ****
PHP SIDE
************************************************** ****
<?php
if(isset($_POST['submit'])) {
$to = "rachellegriffin@people.net.au";
$subject = "mailform";
foreach($_POST['check'] as $value) {
$check_msg .= "Colour: $value\n";
}
foreach($_POST['check'] as $value) {
$check_msg .= "Size: $value\n";
}
$body = "$colour_msg
$size_msg";
echo "Your inquiry has been successfully submitted.";
mail($to, $subject, $body);
} else {
echo "There was a a problem submitting your form";
}
?>
I have 2 sets of check boxes on my online form, I cant get either to display in the resulting email...i know im doing something wrong, i just dont know what. It has a php & html part so I will put them here and hopefully someone can point me in the right direction....
Thank you very much in advance!!
************************************************** ****
HTML SIDE
************************************************** ****
<form method="post" action="testmailer.php">
<input type="hidden" name="sub" value="1">
<table border="0">
<tr>
<td colspan="6"> </td>
</tr>
<tr>
<td colspan="6"><span style="font-weight: bold">What colour do you like?</span></td>
</tr>
<tr>
<td>blue</td>
<td id="checkbox"><input type="checkbox" name="check[]" value="blue" id="blue" /></td>
<td>red</td>
<td id="checkbox"><input type="checkbox" name="check[]" value="red" id="red" /></td>
<td id="name">yellow</td>
<td id="checkbox"><input type="checkbox" name="check[]" value="yellow" id="yellow" /></td>
</tr>
<tr>
<td colspan="6"><span style="font-weight: bold">What size would you like?</span></td>
</tr>
<tr>
<td>large</td>
<td><input type="checkbox" name="check[]" value="large" id="large" /></td>
<td>medium</td>
<td><input type="checkbox" name="check[]" value="medium" id="medium" /></td>
<td>small</td>
<td><input type="checkbox" name="check[]" value="small" id="small" /></td>
</tr>
<tr>
<td colspan="2"> </td>
<td colspan="2"> </td>
<td colspan="2"><label>
<input name="submit" type="submit" rows="9" value="submit" columns=50 id="submit">
</label></td>
</tr>
</table>
</form>
************************************************** ****
PHP SIDE
************************************************** ****
<?php
if(isset($_POST['submit'])) {
$to = "rachellegriffin@people.net.au";
$subject = "mailform";
foreach($_POST['check'] as $value) {
$check_msg .= "Colour: $value\n";
}
foreach($_POST['check'] as $value) {
$check_msg .= "Size: $value\n";
}
$body = "$colour_msg
$size_msg";
echo "Your inquiry has been successfully submitted.";
mail($to, $subject, $body);
} else {
echo "There was a a problem submitting your form";
}
?>