• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

I seem to be using the dropdown function incorrectly... and 36 hours later I thought I'd ask the experts...
If I use "traditional" php like this

<SELECT NAME="officelist" id="oid">
&lt;?php foreach($t3 as $cc):?&gt;
<option value="&lt;?php echo $cc['oid'] ?&gt;">&lt;?php echo $cc['officename'] ?&gt;
&lt;?php endforeach;?&gt;

I get the results I'm hoping for...
If I use the form_dropdown shown below, I get the correct number of rows... but the word "Array" instead of the Array value.

echo form_dropdown('officename', $t3,'0',$js);

I feel I'm missing the point somewhere... ;-) any pointers would be very gratefully received!

[eluser]Bogdan Tanase[/eluser]
If I remember correctly the array you pass to form_dropdown needs to looks smth like this:

$t3=array('key1'=>'value1', 'key2'=>'value2', ... );

your code looks like is a multidimensional array:
$t3=array(0=>array('oid'=>'some_value', 'officename'=>'some_value'),
          1=>array('oid'=>'some_value', 'officename'=>'some_value'), ... );

so it won't work with form_dropdown

Thanks Bogdan... that makes perfect sense... so handbuild is necessary in this instance... I'll get on to it :-)

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.