How come checkbox state is not always passed along to PHP script?

后端 未结 4 955
孤城傲影
孤城傲影 2020-12-01 14:54

I have an HTML form:

Check me!
4条回答
  •  甜味超标
    2020-12-01 15:36

    nickf provided the best answer, but it won't work in the special case when you have multiple checkboxes with the same name. Instead (if you're using jQuery), you can use a fake checkbox to toggle the value of a real, hidden input like so:

    
    
    
    
    
    

    Note that only the hidden checkboxes are named.

提交回复
热议问题