[eluser]Sander Versluys[/eluser]
I've searched the forums and it's been asked before but since 1.7 the validation library has changed, I can't get it to work.
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>
This code is from the docs. I do not understand how the function can know which option to select. Can somebody explain this to me...?
Here's an example of what I'm trying todo:
Code:
<select name="level">
<option value="0" <?= set_select('level', '0'); ?> >Gebruiker</option>
<option value="1" <?= set_select('level', '1'); ?> >Partner</option>
<option value="2" <?= set_select('level', '2'); ?> >Administrator</option>
</select>
In my controller I pass the object $user, wich has the property 'level', to the view. The option with the same level as in the object should be selected.
Any help would be greatly appreciated! Thanks!