title: How to pass the date selected from datepicker to sql query using post?
body: <p>This is my VIEW(roster.php)</p>
  
  <pre><code>&lt;link href="http://cdn.kendostatic.com/2012.3.1024/styles/kendo.common.min.css" rel="stylesheet" type="text/css" /&gt;
  &lt;link href="http://cdn.kendostatic.com/2012.3.1024/styles/kendo.default.min.css" rel="stylesheet" type="text/css" /&gt;
  &lt;link href="http://cdn.kendostatic.com/2012.3.1024/styles/kendo.dataviz.min.css" rel="stylesheet" type="text/css" /&gt;
  &lt;link href="http://cdn.kendostatic.com/2012.3.1024/styles/kendo.mobile.all.min.css" rel="stylesheet" type="text/css" /&gt;
  &lt;script src="http://code.jquery.com/jquery-1.8.2.min.js"&gt;&lt;/script&gt;
  &lt;script src="http://cdn.kendostatic.com/2012.3.1024/js/kendo.all.min.js"&gt;&lt;/script&gt;
  
  &lt;form action="time_model.php" method="post"&gt;
          From: &lt;input type="text" id="datepicker"  name="date_from"/&gt; &lt;br/&gt;&lt;br/&gt;
          To: &lt;input type="text" id="datepicker2" name="date_to" /&gt;
          &lt;/form&gt;
  &lt;input type="submit"&gt;
  &lt;script&gt;
      $(document).ready(function () {
          $.get('&lt;?=base_url()?&gt;index.php/roster/get_emprecord', function(data) {
              if ( data.substring(0,1) == '0' ) return true;
              var emp_roster = JSON.parse(data);
  
              $("#grid").kendoGrid({
                  dataSource: {
                      data: team_dtr,
                      pageSize: 20
                  },
                  groupable: true,
                  sortable: {
                      mode: "multiple",
                      allowUnsort: true
                  },
                  pageable: {
                      buttonCount: 6
                  },
                  scrollable: false,
                  columns: [
  
                      {
                          field: "user_name",
                          title: "Name",
                      },
  
                      {
                          field: "entry_type",
                          title: "Entry Type",
                      },
  
                      {
                          field: "entry_datetime",
                          title: "Date",
                      }
              ]
              });
          });
      }); 
  $("#datepicker").kendoDatePicker();
  $("#datepicker2").kendoDatePicker();
  &lt;/script&gt;
  </code></pre>
  
  <p>In my view I'm selecting 2 dates(date_from, date_to) using a datepicker. Now I'm trying to send in my query(model) the dates that were selected in my view. But it seems not catching it. </p>
  
  <p>This is my MODEL(time_model.php)</p>
  
  <pre><code>public function get_roster($end= '($_POST[date_from])', $start= '$POST[date_to]' )
  {
  $sql="SELECT user_name, entry_type, entry_datetime
  FROM time_entries
  WHERE entry_datetime 
  BETWEEN' ".$start." ' AND ' ".$end." '
  ORDER BY entry_datetime";
  
      $query = $this-&gt;db-&gt;query($sql);
      $result = $query-&gt;result_array();
  
      if ($result) return $result;
      return false;
  }
  </code></pre>
  
  <p>This is my CONTROLLER(roster.php)</p>
  
  <pre><code>public function get_emprecord()
   {
    $data['title'] = "Roster";
    $result = $this-&gt;time_model-&gt;get_employee_record($data)
  if ( $result ) $data['dump'] = json_encode($result);
  else $data['dump'] = "0 Request can not be completed right now.";
  
  $this-&gt;load-&gt;view(roster'', $data);
    }
  </code></pre>
  
  <p>When I try it in my controller alone it says <strong>'0 Request can not be completed right now'</strong>. I think the post that I'm throwing in my query is not catched because its giving 0 results. Definitely I'm doing something not right here :(. </p>
  
  <p>All I just want is to get the record from my database ranging from the selected datepicker(date_from, date_to)taken in my view. Then return the result from similar view. I saw a lot of question seems like this but I don't understand the procedure how it was done. T_T. Thanks in advance for those who could help and enlighten me of my mistake. </p>