出生日期字段从下拉菜单更改为日历

We have a form build in codeigniter in which there is a field of Date of Birth (this field is a drop-down field as of now and We have an option to change the range (Start date and end date) of this field from our admin panel). In this way we don't need to change the .php file.

Date of Birth code in the .php file:

<div class="row-form">
    <div class="span3">Date Of Birth<font color="#FF0000">*</font></div>
       <div class="span9">
          <?php
            // Start date
             $date = $dob_start_date;
            // End date
            $end_date = $dob_end_date;
          ?>
         <select name="dob" id="dob" required>
          <?php
             while (strtotime($date) <= strtotime($end_date)) {
          ?>
          <option value="<?=$date?>" <?php if($dob==$date){ echo "selected";}?>><?=date("d-m-Y", strtotime($date));?></option>
          <?php
            $date = date ("Y-m-d", strtotime("+1 day", strtotime($date)));
            }
           ?>
          </select>
        </div>
    <div class="clear"></div>

</div>

We want to change this date of birth field from drop-down to calendar. Please help me guys how to change this field from drop-down to calendar.

We change the DOB range frequently. Its easy to change the DOB range from admin panel. But editing .php file is difficult. In our form there are 7 more fields like this, and all date fields range is adjustable from admin panel. We don't want to edit the .php files frequently.

This can be done with DatePicker:

Working example: https://jsfiddle.net/Twisty/527zbs4s/

HTML

<div class="row-form">
  <div class="span3">Date Of Birth<font color="#FF0000">*</font></div>
  <div class="span9">
    <input name="dob" id="dob" required type="text" value="">
  </div>
  <div class="clear"></div>
</div>

jQuery

$(function() {
  $("#dob").datepicker({
    dateFormat: 'yy-mm-dd',
    defaultDate: '-18y'
  });
});

An easy way is to set the value, using value="<?php echo $dob_start_date; ?>". You can also pass defaultDate a Date Object from JS (that could be fed with a date string from PHP), a Number of days from today (2, or -1), or a String like '-18y' or '+1m'... There are lots more ways to improve this: http://api.jqueryui.com/datepicker/