Welcome Guest, Not a member yet? Register   Sign In
set_select doesn't work... :/
#1

[eluser]WebbHelp[/eluser]
Hi!

I use set_select(); in this loop:
Code:
<select name="parent">
            <option value="0">0</option>
            &lt;?php
                foreach($menu_db->result() as $menu)
                {
                    echo '<option value="'. $menu->id .'" '. set_select('parent', $menu->id).'>'. $menu->id .'</option>';
                }
            ?&gt;
        </select>

But if the form_validation fail, then there first value is selected anyway, so the 0 is always selected when the page is being updated.

Can you please help me to solve the problem.

Thanks!
#2

[eluser]WebbHelp[/eluser]
I just found the problem...
I had no validation rule for the select menu and that's why it didn't set the selected option.
Can I in some way use set_select, set_value and so on, even if I don't got any validation rules for it?
Because some of the fields are allowed to be empty...

Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB