how can i get multiple checked box values in codeigniter with this code
<input type="checkbox" name="assign[]" value="Keyur"> Keyur<br/>
<input type="checkbox" name="assign[]" value="Ritesh"> Ritesh<br/>
<input type="checkbox" name="assign[]" value="Saurabh"> Saurabh<br/>
<input type="checkbox" name="assign[]" value="Maulik"> Maulik<br/>
at the controller
$data1 = $this->input->post('assign[]');
i do that but can’t get values,where i make mistake????
Use this:
It will be an array, the same thing as
$_POST['assign'].Example:
Unfortunately, if you need to access a specific index, you’ll have to assign it to a variable first or use
$_POSTinstead of$this->input->post(). Example:Update: As of PHP 5.4, you can access the index right from the function call like this:
Not that it’s recommended or better, but just so you know it’s possible.
Either way, make sure the post data and the index is set before you try to access it (if you need to do so this way).