title: how generate report between the two dates using datepicker,ajax,php,mysql.?
body: <p>I have been given a task to generate a report between two given dates using datepicker,ajax,php and mysql. below is my html:</p>
  
  <h1>Date wise Report</h1>
  
  <pre><code>        From date: &lt;input type="text" id="fromdate" value=""&gt;   To date: &lt;input type="text" id="todate" value="" onChange="showuser(document.getElementById('fromdate').value,document.getElementById('todate').value)"&gt;  
          &lt;br&gt;
          &lt;div id="txtHint"&gt;&lt;b&gt;User informathions will be listed here.&lt;/b&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Scripts:</p>
  
  <pre><code>&lt;script&gt;
    $(function() {
      $( "#fromdate" ).datepicker();
      $( "#todate" ).datepicker();
    });
    &lt;/script&gt;
  
  &lt;script type="text/javascript"&gt;
  function showUser(fromdate,todate)
  {
    if (fromdate =="" &amp;&amp; todate=="")
      {
       document.getElementById("txtHint").innerHTML="";
       return;
      } 
  
      if (window.XMLHttpRequest)
       {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
       }
    else
      {// code for IE6, IE5
       xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
  
    xmlhttp.onreadystatechange=function()
      {
       if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200)
        {
          document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
        }
      }
      xmlhttp.open("GET","bet_date.php?fromdate="+fromdate+"&amp;todate="+todate,true);
      xmlhttp.send();
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>Here is the php file which is supposed to generate the report:
  bet_date.php</p>
  
  <pre><code>include("database.php"); 
  $fromdate=$_GET["fromdate"];
  $todate=$_GET["todate"];
   $sql = "SELECT * FROM bookings WHERE date between '$fromdate' and '$todate'";
   $result = mysql_query($sql);
  
   echo "&lt;table border='1'&gt;
  &lt;tr&gt;
  &lt;th&gt;id&lt;/th&gt;
  &lt;th&gt;date&lt;/th&gt;
  &lt;th&gt;start&lt;/th&gt;
  &lt;th&gt;name&lt;/th&gt;
  &lt;th&gt;email&lt;/th&gt;
  &lt;th&gt;phone&lt;/th&gt;
  &lt;th&gt;comments&lt;/th&gt;
  &lt;th&gt;approved&lt;/th&gt;
  &lt;/tr&gt;";
  
  while($row = mysql_fetch_array($result))
    {
    echo "&lt;tr&gt;";
    echo "&lt;td&gt;" . $row['id'] . "&lt;/td&gt;";
    echo "&lt;td&gt;" . $row['date'] . "&lt;/td&gt;";
    echo "&lt;td&gt;" . $row['start'] . "&lt;/td&gt;";
    echo "&lt;td&gt;" . $row['name'] . "&lt;/td&gt;";
    echo "&lt;td&gt;" . $row['email'] . "&lt;/td&gt;";
     echo "&lt;td&gt;" . $row['phone'] . "&lt;/td&gt;";
      echo "&lt;td&gt;" . $row['comments'] . "&lt;/td&gt;";
       echo "&lt;td&gt;" . $row['approved'] . "&lt;/td&gt;";
    echo "&lt;/tr&gt;";
    }
  echo "&lt;/table&gt;";
  </code></pre>
  
  <p>The problem is when I select both the date then nothing happens.
  kindly help me in this situation.
  simple examples would be greatly appreciated.
  Thanks.</p>