<select name="product_cat" multiple="multiple" size="8">
<?php if (isset($product_cat)) : foreach ($product_cat as $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 as $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, Your Query should be :: $this->db->where_in('tbl_sub_products.sub_product_id',$this->input->post('product_cat')); PS: $this->input->post('product_cat') is an array.