PHP: Possible to automatically get all POSTed data And Multiple checkbox unchecked?

后端 未结 1 1580
傲寒
傲寒 2020-12-04 03:19

Hello friends i have a trouble.

I\'m trying to use this code to get dynamically, variables and values of a form, but there is a countless number checkbox, which may

1条回答
  •  攒了一身酷
    2020-12-04 03:57

    Only "successful" controls are submitted. An unchecked checkbox or radio button is not "successful".

    You need to declare a default value with a hidden input. Make sure the hidden input comes before the checkbox so if the checkbox is checked it will override the default hidden input since the names are the same:

    
    
    

    To use an array you need to explicitly define the indexes so they are the same:

    
    
    

    0 讨论(0)
提交回复
热议问题