I want to use my db values of table (Category) into a product/add form, but not able to get the values.
Model :
function getAllCategories()
{
$query = $this->db->get('category');
return $query->result_array();
}
Controller:
function getAllCategories()
{
$data['groups'] = $this->productmodel->getAllCategories();
$this->load->view('admin/product/add',$data);
}
View:
<div class="form-group">
<label for="exampleInputEmail1">Brand </label>
<select class="form-control">
<?php
$i = 0;
while($i < count($groups)){
$val= $groups[$i]['value'];
$des = $groups[$i]['category_name'];
echo "<option value='$i'>$des</option>";
}?>
</select>
</div>
Help me please it is urgent.I took reference from stack overflow only, but was not able to do it.