I have been working on a contact form for a website and I got this problem: I have 4 checkboxgroups, every each of them have at least 3 checkboxes that are available to check. We don't want them to be required to send the email. So the code is this:
$CheckboxGroup1 = array();
if(isset($_POST['submit'])){
$name = $_POST['name'];
$attending = $_POST['attending'];
$CheckboxGroup1 = isset($_POST['CheckboxGroup1']) ? $_POST['CheckboxGroup1'] : 'Nothing checked';
HTML:
<h4>What kind of set-up would you like?</h4>
<p>Additional fees may apply for living room/specialty set-ups.</p>
<p><div class="inline-field">
<label>
<input type="checkbox" name="CheckboxGroup1[]" value="Living Room">
Living Room</label>
<br>
<label>
<input type="checkbox" name="CheckboxGroup1[]" value="Conference Room">
Conference Room</label>
<br>
<label>
<input type="checkbox" name="CheckboxGroup1[]" value="Other">
Other (please specify at the end of the form)</label>
<br>
</div></p>
When none of the checkboxes is selected I get the message "Nothing checked" and when one of them is selected I get the value of it. The problem is when I select more than one, I get this in my email: What kind of set-up will you like?: Array (not the name of those selected).
I do not know what I have to change to make it work the right way.
Any help would be very much appreciated.
Aucun commentaire:
Enregistrer un commentaire