I noticed that PHP seems to return only values of checked checkboxes. I would like to see a list of checkboxes, not just values of checked checkboxes. Is there a way to detect variables of unchecked boxes?
I asked because I want to be able to update settings. For example, I have a few options that are already checked but if an user decides to uncheck an option, I need to know that unchecked value so I can update the option to be disabled.
I just ran into this problem myself. I solved it by adding a duplicate
hidden
field with the same name. When the browser sends this information, the second field overrides the first (so ensure that thehidden
field comes first).If the
checkbox
is not checked you get:If the
checkbox
is checked you get: