I'm trying to get multiple checkbox values I get the last value always not all of it I tried to check if it array but it's single value
<?php echo form_open('user/favorit_cats');?>
<h1>please select the food cateogry you want to see it the most</h1>
<?php
for($i=0;$i<sizeof($cats_names);$i++){
echo'<input type="checkbox" name="meal_cat" value='.$cats_id[$i].'>';
echo '<label for="'.$cats_id[$i].'">'.$cats_names[$i].'</label><br>';
}
?>
<?php echo form_submit('submit','set as favorit'); ?>
</form>
and my controller
if($this->input->post('subm it')){
if(is_array($this->input->post['meal_cat'])){
echo'array';
}
}
I want to get all the values that checked
Aucun commentaire:
Enregistrer un commentaire