[eluser]PoetaWD[/eluser]
Sorry for this very infant question.. I am just learning PHP.
I am using the form helper to create a <select> input...
The data is passed to the view file as a object...
But i am having trouble building the array to generate the <select> input !
Here is what I got:
Code:
foreach ($clientes as $cliente)
{
$opcoesC[] = array($cliente->id => $cliente->id.' - '.$cliente->stNome);
}
echo form_dropdown('cliente', $opcoesC);
But that will generate a array like this:
$opcoesC[0] = 'aaaaaaaaa' => 'aaaaaaaaaaa'
$opcoesC[1] = 'bbbbbbbbb' => 'bbbbbbbbbbb'
...
or like this:
Array ( [0] => Array ( [7] => 7 - jkkk ) [1] => Array ( [8] => 8 - jk ) [2] => Array ( [9] => 9 - kkh ) [3] => Array ( [10] => 10 - klçklçklç ) )
I needed to be generated like this:
$opcoesC = array( 'aaaaaaa' => 'aaaaaaa','bbbbbbb' => 'bbbbbbbb','cccccccc'=>'ccccccc' ....);
I have also tryed this:
Code:
$opcoes = array(
'' => 'Selecione o funcionário',
foreach ($funcionarios as $funcionario)
{
$funcionario->id => $funcionario->id.' - '.$funcionario->stNome,
}
);
Can anyone give me a hint ?
Thanks in advance...