Welcome Guest, Not a member yet? Register   Sign In
set_select problem in setting default values from db
#2

[eluser]xzela[/eluser]
Hi,

This is what I do to determine which select field to use. It may not be the 'proper' way to do it, however it works for me.

Code:
<select name='gender'>
    &lt;?php if(set_value('gender') == 'Male'):?&gt;
        <option value='male' selected >Male</option>
        <option value='female'>Female</option>
    &lt;?php else: ?&gt;
        <option value='male'>Male</option>
        <option value='female' selected>Female</option>
    &lt;?php endif;?&gt;
</select>

This probably isn't the best way to do it now that i think about it. I typically have a foreach loop to loop through all the options and use an if statement to determine the default selection.

I don't know, just a suggestion... Smile


Messages In This Thread
set_select problem in setting default values from db - by El Forum - 02-02-2009, 06:26 PM
set_select problem in setting default values from db - by El Forum - 02-02-2009, 07:29 PM
set_select problem in setting default values from db - by El Forum - 02-02-2009, 08:36 PM
set_select problem in setting default values from db - by El Forum - 02-03-2009, 05:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB