Hello everybody,
I've made a form that contains a lot of checkboxes. The idea is that users can check the boxes of the products they are interested in and send the form.
I've given the name 'artwork' to all of the checkboxes and changed the value depending on which artwork it is.
The problem I've come across is that when multiple checkboxes are checked only the value of the last one gets mentioned in the email. I'm looking for a way of sending the values of all the checkboxes that are checked, without having to create a new name for each checkbox. This is because new products are going to be continually added to the form and I don't want to have to keep adding to the php of the form sender.
The form looks a little like this:
And the form-sender looks like this:HTML Code:<div id="purchaseForm"> <form action="sender2.php" name="purchase" id="purchase" method="post"> <div id="formPart1"><table cellspacing="0"> <tr id="titleBar"> <td id="itemDescription">Item Description</td> <td id="itemType">Item Type</td> <td id="price" colspan="2">Price</td> </tr> <tr> <td>Product 1</td> <td>Lazer Print</td> <td>$10</td> <td><input type="checkbox" name="artwork" value="07-late-01" /></td> </tr> <tr> <td>Product 2</td> <td>Lazer Print</td> <td>$10</td> <td><input type="checkbox" name="artwork" value="07-late-02" /></td> </tr> <tr> <td>Product 3</td> <td>Lazer Print</td> <td>$10</td> <td><input type="checkbox" name="artwork" value="07-late-03" /></td> </tr> <tr> <td>Product 4</td> <td>Lazer Print</td> <td>$10</td> <td><input type="checkbox" name="artwork" value="07-late-04" /></td> </tr> </table></div><!-- end of formPart1 --> <!-- ...the rest of the form, etc. ... --> </form>
If anyone has any ideas please let me know.PHP Code:<?
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$extra = "result.php?sent=yes";
$name = $_POST['name'];
$email = $_POST['email'];
$address = $_POST['address'];
$artwork= $_POST['artwork'];
$mail = $_POST['mailing'];
$to = "monkeyzbox@dc5b.com";
$subject = "Purchase";
$body = "Name: ".$name."\r\n\r\n";
$body .= "Email: ".$email."\r\n\r\n";
$body .= "Delivery Address: ".$address."\r\n\r\n";
$body .= "Artwork selected: ".$artwork."\r\n\r\n";
$from = "dog@dc5b.com";
mail($to, $subject, $body, $from);
header("Location: http://$host$uri/$extra");
exit;
?>
Thanks,
Dog



Reply With Quote


Bookmarks