• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
An idea for foreach

#1
[eluser]Gabi3xz[/eluser]
I have form dropdown with the results of foreach.
Code:
foreach ($result_cat->result() as $row):
       echo form_dropdown($row->id, $row->cat_name);
endforeach;
Problem is that multiply and form_dropdown for each result.
how do I set up correctly?

#2
[eluser]sanir[/eluser]
try this code.

Code:
foreach ($result_cat->result() as $row):
  $data[$row->id] = $row->cat_name;
      
endforeach;
echo form_dropdown($data);


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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