THIS IS NOT A DUPLICATE
I follow the exact steps that the my question is a suppose "duplicate" of and I get a completely different result.
I have a form that has 5 checkboxes. When I submit the form and I print the value of the checkbox array I get the word on
for each checkbox that was selected instead of the value.
Here is my HTML
<div class="checkbox">
<label style="width:auto !important;">
<input type="checkbox" name="additional[]" value="contact">
Contact Form
</label>
</div>
<div class="checkbox">
<label style="width:auto !important;">
<input type="checkbox" name="additional[]" value="google">
Google Map
</label>
</div>
<div class="checkbox">
<label style="width:auto !important;">
<input type="checkbox" name="additional[]" value="sub">
Subscribe Feature
</label>
</div>
<div class="checkbox">
<label style="width:auto !important;">
<input type="checkbox" name="additional[]" value="caro">
Image carousel
</label>
</div>
<div class="checkbox">
<label style="width:auto !important;">
<input type="checkbox" name="additional[]" value="bar">
Search Bar
</label>
</div>
This is my PHP to get the value of additional[]
when the form is submitted,
$add = $_POST["additional"];
I then loop through them to see each checkbox that was selected,
$addThings = "";
foreach($add as $value) {
$addThings.= " $value ";
}
echo $addThings;
The output is this,
on on on
It displays an on
for each checkbox that has been selected.
How can I get it to display the actual value?