[eluser]Neeraj Kumar[/eluser]
Hi all!
I have a huge list of years, from 1900 - 2009. Now following is my problem
I need to store data into MySQl DB, this is what I do in view, when a user registers at site for the first time:
Code:
<select name="year" id="year">
<option value="-1" <?php echo set_select('year', '-1') ?>>Select</option>
<?php
for($ctr = 1900; $ctr <=date('Y'); $ctr+=1)
echo "<option value='$ctr'" . set_select('year', $ctr) . ">$ctr</option>"
?>
</select>
I can run form_validation etc. perfectly. The problem arises when I want a user to edit this field again.
For that I present him another view viz. 'edit_view'. Now what and how should I create this drop down dynamically and present him all the fields with the one stored in the database as selected.
I tried to use form_dropdown(), but where am supposed to specify the set_select() so that when form is submitted and processed, user can see last selected value just like he saw in registration form