vendredi 30 décembre 2016

Checkbox submits "value" no matter what

The simplest things........

I have a form with two separate checkboxes. There's other stuff too, but basically it's this.

<form>
  <label style="font-size: 20px; width: 120px">Option 1</span> <input type="checkbox" name="selection_1" id="selection_1" style="width: 25px" value="1"/></label>
  <label style="font-size: 20px; width: 120px">Option 2</span> <input type="checkbox" name="selection_2" id="selection_2" style="width: 25px" value="2"/></label>
</form>

Every time I submit the form, both checkboxes are submitted as if they're checked. This happens even if neither or only one is selected. $_POST['selection_1'] is always ending up as 1 and $_POST['selection_2'] is always ending up as 2.

What am I missing here?




Aucun commentaire:

Enregistrer un commentaire