Hi,
So I have this HTML
In the database, every day has it’s own row with a column containg a boolean. When clicking on the submit button, every row in the database should be updated and set the boolean according to the checkbox. Therefore, I guess I would need an array like this:
[ {"date":"2016-06-11", "bool":"off"}, {"date":"2016-06-12", "bool":"on"}, {"date":"2016-06-13", "bool":"off"} ]
I could give the checkboxes the name ‘chk’, but that would only give me an array with the value of the checkbox. I still don’t know for which date the checkbox is then. Also, checkboxes that aren’t checked aren’t visible in this array.
I could also use the ‘hidden field technique’ by adding a hidden field under every checkbox and working with client-side validation to build the array (Stackoverflow)
Is this the way to go or is there a better technique available?