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

[eluser]datguru[/eluser]
Hey thanks for the reply Mike, that has indeed solved the problem of populating the array. The only issue now is that it is giving me an array of arrays, so when I go to fill the form_dropdown with the options it gives me the options of Array, Array, Array.... Is there a better way to dynamically fill the form_dropdown()?

Thanks again

Edit: Found a solution....

What I did was the following...

Code:
$tmp2 = array() //Needs to be an array type otherwise the first merge will not work
        foreach($suppliers as $row)
        {
        $tmp = array( $row->supplier_id => $row->supplier_name);
        $tmp2 = array_merge($tmp,$tmp);
        }
$data['options'] = $tmp2;

Thanks again Mike without your help would not of got there.

Cheers

Chris


Messages In This Thread
Dynamically fill an array from Mysql using Form Helper for dropdown list. - by El Forum - 10-19-2008, 08:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB