I’m trying to figure out how to turn this object and use it for the options for my dropdown but I’m having a hard time understanding how to even with the documentation on the CodeIgniter webiste.
Array
(
[0] => stdClass Object
(
[id] => 1
[event_name] => First City Shodown
[status_id] => 1
)
[1] => stdClass Object
(
[id] => 2
[event_name] => First City Festival
[status_id] => 1
)
)
<?php
$options = array(
);
?>
<?php echo form_dropdown('eventname', $options); ?>
What you want to do is loop through each event object, and retrieve both the event id as well as the event name. This can be done quite easily with the use of a foreach loop, since the event objects are stored in an array.
Assuming those objects are stored in an array called
$events: