Welcome Guest, Not a member yet? Register   Sign In
How do I use set_select with database values?
#5

[eluser]taro uma[/eluser]
I am doing this to create a dropdown menu of years, starting with the current year and looping to 10+ years. Is there a way to use the form helper set_select() with this so if the form is reloaded (like with errors) this dropdown remembers the user selected option? currently I have it set so that the current year is selected, but can't see a way to use set_select() with it.

Code:
<?php
$year = date("Y");
$years = array();
for($i = $year; $i <= $year + 10; $i++){
    $years['$i']='$i';
}

echo form_dropdown('ccyear', $years, $year);
?&gt;


Messages In This Thread
How do I use set_select with database values? - by El Forum - 04-26-2009, 08:45 PM
How do I use set_select with database values? - by El Forum - 04-26-2009, 08:48 PM
How do I use set_select with database values? - by El Forum - 04-26-2009, 09:04 PM
How do I use set_select with database values? - by El Forum - 04-26-2009, 09:06 PM
How do I use set_select with database values? - by El Forum - 04-29-2009, 03:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB