title: auto select month on the dropdown base on the present month
body: <p>I want to make my dropdown list auto select base on the present month
  and show the record on my datatable 
      </p>
  
  <pre><code>        &lt;div class="container-fluid"&gt;
  
  
      &lt;h2 class="form-signin-heading"&gt;Schedule Management&lt;/h2&gt;&lt;hr /&gt;
      &lt;button class="btn btn-info" type="button" id="btn-add"&gt; &lt;span class="glyphicon glyphicon-pencil"&gt;&lt;/span&gt; &amp;nbsp; Add Schedule&lt;/button&gt;
      &lt;button class="btn btn-info" type="button" id="btn-view"&gt; &lt;span class="glyphicon glyphicon-eye-open"&gt;&lt;/span&gt; &amp;nbsp; View Schedule&lt;/button&gt;
      &lt;hr /&gt;
  </code></pre>
  
  <p>this part is where I select the month and submit(If i pick a month on my drop down ex.Nov it will auto submit its already working) what I want is to select automatically default value base on the present month ex. next month is Dec. everytime I open my website its already selected in Dec.
       
  
  <pre><code> (isset($_POST["months"])) ? $dropDownVal = $_POST["months"] : $dropDownVal=0;
  
     ?&gt;
      &lt;div class="content-loader"&gt;
             &lt;form method="post" action="index.php"&gt;
   Select a month &lt;select name="months"  id="months" onchange ='this.form.submit()'&gt;
      &lt;option value="0" &lt;?php if ($dropDownVal==0) echo 'selected'; ?&gt;&gt;--------------&lt;/option&gt;
      &lt;option value="1" &lt;?php if ($dropDownVal==1) echo 'selected'; ?&gt;&gt;January&lt;/option&gt;
      &lt;option value="2" &lt;?php if ($dropDownVal==2) echo 'selected'; ?&gt;&gt;February&lt;/option&gt;
      &lt;option value="3" &lt;?php if ($dropDownVal==3) echo 'selected'; ?&gt;&gt;March&lt;/option&gt;
      &lt;option value="4" &lt;?php if ($dropDownVal==4) echo 'selected'; ?&gt;&gt;April&lt;/option&gt;
      &lt;option value="5" &lt;?php if ($dropDownVal==5) echo 'selected'; ?&gt;&gt;May&lt;/option&gt;
      &lt;option value="6" &lt;?php if ($dropDownVal==6) echo 'selected'; ?&gt;&gt;June&lt;/option&gt;
      &lt;option value="7" &lt;?php if ($dropDownVal==7) echo 'selected'; ?&gt;&gt;July&lt;/option&gt;
      &lt;option value="8" &lt;?php if ($dropDownVal==8) echo 'selected'; ?&gt;&gt;August&lt;/option&gt;
      &lt;option value="9" &lt;?php if ($dropDownVal==9) echo 'selected'; ?&gt;&gt;September&lt;/option&gt;
      &lt;option value="10"&lt;?php if ($dropDownVal==10) echo 'selected'; ?&gt;&gt;October&lt;/option&gt;
      &lt;option value="11"&lt;?php if ($dropDownVal==11) echo 'selected';?&gt;&gt;November&lt;/option&gt;
      &lt;option value="12"&lt;?php if ($dropDownVal==12) echo 'selected';?&gt;&gt;December&lt;/option&gt;
  &lt;/select&gt;
  
  &lt;noscript&gt;&lt;input type="submit" value="Submit"&gt;&lt;/noscript&gt;
  
  &lt;/form&gt;
      &lt;table cellspacing="0" width="100%" id="example" class="table table-striped table-hover table-responsive"&gt;
  
      &lt;thead&gt;
      &lt;tr&gt;
      &lt;th&gt;Sched #&lt;/th&gt;
      &lt;th&gt;First Name&lt;/th&gt;
      &lt;th&gt;Last Name&lt;/th&gt;
      &lt;th&gt;Check In Date&lt;/th&gt;
      &lt;th&gt;Check Out Date&lt;/th&gt;
      &lt;th&gt;Room Rate&lt;/th&gt;
      &lt;th&gt;Reservation Fee&lt;/th&gt;
      &lt;th&gt;Date Paid&lt;/th&gt;
      &lt;th&gt;Mode of Paymnet&lt;/th&gt;
      &lt;th&gt;Status&lt;/th&gt;
      &lt;th&gt;edit&lt;/th&gt;
      &lt;th&gt;delete&lt;/th&gt;
  
      &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
      &lt;?php
      require_once 'dbconfig.php';
      if(isset($_POST['months'])){ $months = $_POST['months']; }else { $months='';}
      $sqladd = mysql_query("SELECT sum(rrate) from tblguest WHERE status = 0 and MONTH(checkin) = '".$months."' ");
      while($result = mysql_fetch_assoc($sqladd)){
      $stmt = $db_con-&gt;prepare("SELECT * FROM tblguest WHERE status = 0 and MONTH(checkin) = '".$months."' ");
      $stmt-&gt;execute();
      while($row=$stmt-&gt;fetch(PDO::FETCH_ASSOC))
      {
          ?&gt;
          &lt;tr&gt;
          &lt;td&gt;&lt;?php echo $row['id']; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $row['fname']; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $row['lname']; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $row['checkin']; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $row['checkout']; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $row['rrate']; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $row['reservefee']; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $row['datepaid']; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $row['modepayment']; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $row['stats']; ?&gt;&lt;/td&gt;
          &lt;td align="center"&gt;
          &lt;a id="&lt;?php echo $row['id']; ?&gt;" class="edit-link" href="#" title="Edit"&gt;
          &lt;img src="edit.png" width="20px" /&gt;
          &lt;/a&gt;&lt;/td&gt;
          &lt;td align="center"&gt;&lt;a id="&lt;?php echo $row['id']; ?&gt;" class="delete-link" href="#" title="Delete"&gt;
          &lt;img src="delete.png" width="20px" /&gt;
          &lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;?php
      }  
      echo  "&lt;b&gt;Total Room Rental Income&lt;/b&gt; = "  , $result['sum(rrate)'];
      }
      ?&gt;
  
  
  
  
      &lt;/tbody&gt;
  </code></pre>