It may sound weird but I just wanted to ask where I went wrong. I'm capturing the week which I called period but when when I choose the final week like for example last week of july which includes July 27 to August 2. I can capture the July 27 to July 31 but cannot capture 1 and 2.
Here's my code, Kindly advice where I went wrong.
Here's my code for months:
<label for="month" style="padding-right: 10px;margin-top:7px;">Month</label>
          <select name="month" id="month" class="text ui-widget-content ui-corner-all">
                <option value="0">Choose Month</option>
                <option value="January">January</option>
                <option value="February">February</option>
                <option value="March">March</option>
                <option value="April">April</option>
                <option value="May">May</option>
                <option value="June">June</option>
                <option value="July">July</option>
                <option value="August">August</option>
                <option value="September">September</option>
                <option value="October">October</option>
                <option value="Novermber">Novermber</option>
                <option value="December">December</option>
          </select>
here's my code for week or period
    <label for="period" style="padding-right: 10px;margin-top:7px;" visible="false">Period</label>
          <select name="period" id="period" class="text ui-widget-content ui-corner-all">
                <option value="">Choose Period</option>
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
                <option value="4">4</option>
                <option value="5">5</option>
          </select>
and the year
<select name="year" id="year" class="text ui-widget-content ui-corner-all">
                <?php
                    $year = date("Y");
                    $start = $year - 100;
                    for ($i = $start; $start <= $year; $start++) {
                        echo '<option value="' . $start. '">' . $start. '</option>';
                    }
                ?>
          </select>
and if I pick July in month, 5 in july and 2014 in year here's the result

Asnwer must be July 27 to August 2 so the answer must be JULY 27-2, 2014. How can I fix this. Thanks for the help.
Sorry about this, Here's the process made up of jquery
$(function(){
        $("#period").change(function(){
          var dateStr = "";
          var month = $('#month').val();
          var monthToDisplay = $('#month option[value='+month+']').text();
          var period = $('#period').val();
          var year = $('#year').val();
          var date = new Date(month+'/01/'+year);
          var day = date.getDay();
          var diff = 7 - parseInt(day);
          var start = 1;
          var end = 31;
          var lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
            //alert(lastDay);
          if(period ==1)
          {
              end = diff;
          }
          else
          {
             start = diff + 7 * (parseInt(period) - 2)
            end = start+7;
            if(parseInt(end) > parseInt(lastDay))
               end = lastDay;
          }
           dateStr = monthToDisplay+', '+start+' - '+end+' '+year;
          $('#dateStr').html(dateStr);
        });
        $("#year").change(function(){
          var dateStr = "";
          var month = $('#month').val();
          var monthToDisplay = $('#month option[value='+month+']').text();
          var period = $('#period').val();
          var year = $('#year').val();
          var date = new Date(month+'/01/'+year);
          var day = date.getDay();
          var diff = 7 - parseInt(day);
          var start = 1;
          var end = 31;
          var lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
            //alert(lastDay);
          if(period ==1)
          {
              end = diff;
          }
          else
          {
             start = diff + 7 * (parseInt(period) - 2)
            end = start+7;
            if(parseInt(end) > parseInt(lastDay))
               end = lastDay;
          }
           dateStr = monthToDisplay+', '+start+' - '+end+' '+year;
          $('#dateStr').html(dateStr);
        });
        $("#month").change(function(){
          var dateStr = "";
          var month = $('#month').val();
          var monthToDisplay = $('#month option[value='+month+']').text();
          var period = $('#period').val();
          var year = $('#year').val();
          var date = new Date(month+'/01/'+year);
          var day = date.getDay();
          var diff = 7 - parseInt(day);
          var start = 1;
          var end = 31;
          var lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
            //alert(lastDay);
          if(period ==1)
          {
              end = diff;
          }
          else
          {
             start = diff + 7 * (parseInt(period) - 2)
            end = start+7;
            if(parseInt(end) > parseInt(lastDay))
               end = lastDay;
          }
           dateStr = monthToDisplay+', '+start+' - '+end+' '+year;
          $('#dateStr').html(dateStr);
        });
    });
