php - Pass array from view to models in codeigniter -


function income_reports : model

$this->db->where('tbl_sub_products.sub_product_id', $this->input->post('product_cat')); 

hi, kind of new codeigniter .some 1 can please explain me how can change code grab multiple inputs view.

it takes 1 value @ ones. if select multiple values shows empty array.

 <select name="product_cat" multiple="multiple" size="8">   <?php if (isset($product_cat)) : foreach ($product_cat $row) : ?> <option value="<?php echo $row->sub_product_id; ?>"> <?php echo $row->sub_product_name; ?> </option> <?php endforeach; ?> <?php endif; ?>   </select> 

to

<select name="product_cat[]" multiple="multiple" size="8">  <?php if (isset($product_cat)) : foreach ($product_cat $row) : ?> <option value="<?php echo $row->sub_product_id; ?>"> <?php echo $row->sub_product_name; ?>  </option> <?php endforeach; ?> <?php endif; ?>  </select> 

in controller or model, query should :: $this->db->where_in('tbl_sub_products.sub_product_id',$this->input->post('product_cat')); ps: $this->input->post('product_cat') array.


Comments