Welcome Guest, Not a member yet? Register   Sign In
Dynamically fill an array from Mysql using Form Helper for dropdown list.
#4

[eluser]Erwin Setiawan[/eluser]
Hey why your code not working for me?
i had the same problem to..
and try to get solution, but while I try your solution, I can't get all dropdown value displayed.

I try to get another solution and finally i found it.

this is my dynamically dropdown script for my application.


Code:
$cat_id="";
$category="";
$query=$this->dn_categories_model->get_all();
foreach($query as $row):
        $cat_id .= "$row->cat_id";
    $cat_id .= ",";
    $category .= "$row->category";
    $category .= ",";
endforeach;
$comma=",";//separate by commas
$arr_cat_id=split($comma,$cat_id);
$arr_category=split($comma,$category);
$options=array_combine($arr_cat_id,$arr_category);
            
$data['input_category'] = $options;


And work clearly^^


Messages In This Thread
Dynamically fill an array from Mysql using Form Helper for dropdown list. - by El Forum - 11-24-2008, 03:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB