<label>Session </label>
<select name="year" required class="form-control">
<?php for ($i=$start_year;$i<$end_year;$i++)
{
$j=$i+1;
echo '<option value="'.$i."-".$j.'"'; if(date("Y")==$i) echo 'selected="selected"'; echo '>'.$i."-".$j.'</option>';
} ?>
<?php echo isset($_POST['year']) ?
'<option value="'.$_POST['year'].'" selected="selected">'.$_POST['year'].'</option>' : ''; ?>
</select>
<select name="year" required class="form-control">
<?php for ($i=$start_year;$i<$end_year;$i++)
{
$j=$i+1;
echo '<option value="'.$i."-".$j.'"'; if(date("Y")==$i) echo 'selected="selected"'; echo '>'.$i."-".$j.'</option>';
} ?>
<?php echo isset($_POST['year']) ?
'<option value="'.$_POST['year'].'" selected="selected">'.$_POST['year'].'</option>' : ''; ?>
</select>
No comments:
Post a Comment