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
hiddenfield with the same name. When the browser sends this information, the second field overrides the first (so ensure that thehiddenfield comes first).If the
checkboxis not checked you get:If the
checkboxis checked you get: