• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
$data['query'] result to form_dropdown()

#1
[eluser]dimaomni[/eluser]
Hello Dear.
I have stuck with passing data from Controller to Viewer.
How to make dropdawn menu with combined number.letter column?
print_r($query) in viewer gives below result:
Array
(
[0] => stdClass Object
(
[id] => 1
[number] => 8
[letter] => A
)
[1] => stdClass Object
(
[id] => 9
[number] => 8
[letter] => B
)
[2] => stdClass Object
(
[id] => 10
[number] => 8
[letter] => V
)
-------------------
Controller:
...
$data['query'] = $this->Meditlesson->selectclass();
$this->load->view('admin/vshowbylesson',$data);
...

View:
..
echo form_dropdown('classroom', $query, '1')
...
Thanks in advance!

#2
[eluser]dimaomni[/eluser]
founded:

Model:
foreach($query AS $row):
$letter[$row->letter] = &$row->letter;
$number[$row->number] = &$row->number;
endforeach;

echo form_open('index.php/adminka/studentWork');
echo form_dropdown('classroom', $letter, '1');
echo form_dropdown('classroom', $number, '1');
.....


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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