title: Pass a date input value from View to Controller using Codeigniter
body: <p>I am trying to give the user to select the date he wants, and it will display the reservations for the day he selected. I am using Codeigniter, the MVC framework.</p>
  
  <ol>
  <li><p>How am I setting a default value of the current date for an input date selection?</p></li>
  <li><p>How am I sending the value to the controller and then I am using it for a function in the model.</p></li>
  </ol>
  
  <p></p>
  
  <pre><code>&lt;form id="form_reDate" name="form_reDate" method="POST" action="form_reDate.php"&gt;
   &lt;?php $r_date=@date('d-m-y'); ?&gt;  
      &lt;label for="reservations"&gt;Display reservations for :
      &lt;input type="date" id="date" name="re_date" style="margin-left: 0;"
                         min="2020-01-01" max="2020-12-31" value="&lt;?php $r_date?&gt;"&gt;
     &lt;/label&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>Controller:</strong> </p>
  
  <pre><code>public function form_reDate(){
  
          $newDate = date("Y-m-d",strtotime($this-&gt;input-&gt;post('re_date')));
          $data['tables'] = $this-&gt;Hosting_model-&gt;get_tables($newDate);
  
  }
  </code></pre>