[eluser]Armchair Samurai[/eluser]
There are a couple of ways to approach this.
First, you can do the foreach() approach and just call set_select on each loop:
Code:
<select name="test" size="1">
<?php $result = $test->result();
foreach ($result AS $test):?>
<option value="<?=$test->id;?>" <?=set_select('test', $test->id);?>><?=$test->name;?></option>
<?php endforeach;?>
</select>
The other option would be to use form_dropdown() and call set_value(), but you'd need to put the array in a format which form_dropdown can understand:
Code:
<?php $result = $test->result();
foreach ($result AS $test)
$arr[$test->id] = $test->name;
echo form_dropdown('test', $arr, set_value('test'), 'size="1"');?>