[eluser]Kyle Johnson[/eluser]
Direct from the user guide:
Code:
<select name="myselect">
<option value="one" <?php echo set_select('myselect', 'one', TRUE); ?> >One</option>
<option value="two" <?php echo set_select('myselect', 'two'); ?> >Two</option>
<option value="three" <?php echo set_select('myselect', 'three'); ?> >Three</option>
</select>
So, that said, each echo of yours would look more like this...
Code:
<select name="whatever">
<?php
for ($i = 1; $i<=num_rows; $i++) {
echo “<option value='{$list[$i][‘key’]}' set_select('whatever')>{$list[$i][‘name’]}</option>“;
}
?>
</select>
Alternately, I've taken a liking to sprintf lately:
Code:
<select name="whatever">
<?php
for ($i = 1; $i<=num_rows; $i++) {
$key = $list[$i][‘key’];
$name = $list[$i][‘name’];
echo sprintf(“<option value='%s' set_select('whatever',%s)>%s</option>“, $key, $key, $name);
}
?>
</select>
My quotes/braces may be off so you'll have to adjust.