how to get checkbox values using php codeigniter in Controller

后端 未结 4 393
时光取名叫无心
时光取名叫无心 2020-12-09 20:28

I am new to PHP codeigniter,

how to get checkbox values using php Codeigniter in Controller.

Here is the Checkboxes, i want to get checkbox values base on na

4条回答
  •  一向
    一向 (楼主)
    2020-12-09 21:05

    If only one of these checkboxes can be selected at a time, you should use a group of radio buttons (type="radio") instead. I assume this is what you are trying to do since the names of all of the inputs are the same.

    To get the value of the checkbox or radio button group, use:

    $this->input->post('businessType')
    

    Edit:

    If you are actually wanting checkboxes, you will need to name them all something different:

    
    
    
    

    And then use the same post method as before:

    $this->input->post('businessType1') //the first checkbox's value
    $this->input->post('businessType2') //the second
    $this->input->post('businessType3') //the third
    

提交回复
热议问题