How to read if a checkbox is checked in PHP?

后端 未结 18 1212
刺人心
刺人心 2020-11-22 07:54

How to read if a checkbox is checked in PHP?

18条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-22 08:27

    Zend Framework use a nice hack on checkboxes, which you can also do yourself:

    Every checkbox generated is associated with a hidden field of the same name, placed just before the checkbox, and with a value of "0". Then if your checkbox as the value "1", you'll always get the '0' or '1' value in the resulting GET or POST

    
     
    

提交回复
热议问题