Welcome Guest, Not a member yet? Register   Sign In
[Solved] Remember Selected Option Value If Form Errors
#2

(This post was last modified: 09-02-2016, 06:58 PM by wolfgang1983.)

I have found the solution using set_select()

Code:
<div class="form-group">
<label class="col-lg-2 col-md-2 col-sm-12 col-xs-12" for="firstname">Country</label>
<div class="col-lg-10 col-md-10 col-sm-12 col-xs-12">
<select name="country" class="form-control" id="country">
    <?php foreach ($countries as $code => $country) {?>
        <option value="<?php echo $code;?>" <?php echo set_select('country', $code) ;?>><?php echo $country;?></option>
    <?php }?>
</select>
</div>    
</div>

<div class="form-group">
<label class="col-lg-2 col-md-2 col-sm-12 col-xs-12" for="firstname">Time Zone</label>
<div class="col-lg-10 col-md-10 col-sm-12 col-xs-12">
<select name="timezone" class="form-control" id="timezone">
    <?php foreach ($timezones as $timezone) {?>
        <option value="<?php echo $timezone;?>" <?php echo set_select('timezone', $timezone) ;?>><?php echo $timezone;?></option>
    <?php }?>
</select>
</div>    
</div>
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply


Messages In This Thread
RE: Remember Selected Option Value If Form Errors - by wolfgang1983 - 09-02-2016, 06:56 PM



Theme © iAndrew 2016 - Forum software by © MyBB