Dynamic year dropdown with +25 years

<select autocomplete=”cc-exp-year” id=”yer” name=”cd_year” data-validation=”required” data-validation-error-msg=”Credit Card Exp Year”>
<option selected=”selected” value=””>Year</option>
<?php for($i=date(“Y”);$i<date(“Y”)+25;$i++){ ?>
<option value=”<?php echo $i; ?>” <?php echo ($i==$this->input->post(‘cd_year’))?’selected=”selected”‘:”; ?>><?php echo $i; ?></option>
<?php }?>
</select>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s