jeudi 30 mars 2017

Multiple checkboxes to variable logic

I am looking to create a simple page using HTML and (probably) PHP or JQuery. The page should allow for multiple checkbox selection, and give a variable a value based on which boxes are checked. This can be on submit or can render live on the page.

i.e.
Checkbox 1
Checkbox 2
Checkbox 3

If checkbox 1 is checked, variable = X
If checkbox 1 & 2 are checked, variable = Y
If no checkboxes are checked, variable = Z

What is the best way to approach doing this?




Aucun commentaire:

Enregistrer un commentaire