I'm trying to get a form populated by data coming from a Datamapper object.
Here's my controller code:
$sub_list = new Subject();
$data['s'] = $sub_list->all;
In my view I'd want to show a dropdown form with the data coming from that object but I can't make it work.
<?php echo form_dropdown('accesso', $s);?>
Just show me "Subject" for every field in the db.
Many thanks for the help! I'm sorry for the silly issue!
EDIT: Problem solved!
<?php foreach ($s as $a):?>
<?php $options[$a->name] = $a->name; ?>
<?php endforeach ?>
<?php echo form_dropdown('accesso', $options);?>