[eluser]pettechservices[/eluser]
I'm going to assume its just me and I'm the idiot here... but I'm totally at a loss.
I'm using set_select and it seems upon re-population, it is not keeping the submitted value. I have CONFIRMED that I have a set_rule set for the field, so its not that.
This code works (in my view):
Code:
<select tabindex="1" name="clienttypeid" id="clienttypeid">
<option value="0" <?php echo set_select('clienttypeid', '0'); ?>>Select Client Type...</option>
<option value="1" <?php echo set_select('clienttypeid', '1'); ?>>Opt 1</option>
<option value="2" <?php echo set_select('clienttypeid', '2'); ?>>Opt 2</option>
</select>
But if I'm trying to set the options from the database, in the following code, its not working.
Code:
<select tabindex="1" name="clienttypeid" id="clienttypeid">
<option value="0" <?php echo set_select('clienttypeid', '0'); ?>>Select Client Type...</option>
<?php foreach ($clienttypes->result() as $ct): ?>
<option value="<?=$ct->cfg_clienttypes_id?>" <?php echo set_select('clienttypeid','<?php echo $ct->cfg_clienttypes_id?>');?>><?php echo $ct->cfg_clienttypes_id?>-<?=$ct->cfg_clienttypes_desc?></option>
<?php endforeach; ?>
</select>
The dropdown options are populating correctly and all, but the when the form is submitted and validation FAILS, it is not keeping the proper selected option.
Any ideas??!?!?!?!!? PLEASE HELP. Thank you!