Inside a form using datepicker to get date and pass date value to javascript in onchange event, i tried this code, but is not work.
    <form name="users" onchange="showUser(this.value)">     
    <label>Select By Date:</label>                          
    <?php 
    include 'connection/db_connection.php';
    echo '<div class="form-group">                              
    <input type="text" name="date2" value="" class="form-control" id="dt2" required />
    </div> ';
    ?>
    </form>
My script:
<script type="text/javascript">
function showUser(str) {
if (str=="") {
 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 && xmlhttp.status==200) {
  document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
 }
 }
 xmlhttp.open("GET","get_export.php?q="+str,true);
 xmlhttp.send();
 }
 </script>
I need to pass a date value and get the recods from mysql table using where clause
get_export.php:
<?php
$q = intval($_GET['q']);
 include 'connection/db_connection.php';
 $sql="SELECT * FROM admin_export where datetime='".$q."'";
 $result = mysql_query($sql);
 ?>
 <div class="table-responsive">
     <table class="table table-striped table-bordered table-hover">
     <thead>
         <?php
             echo "
                <th>SNO</th>
                <th>Item Code</th>
                 <th>Product Name</th>
                 <th>Quantity</th>
                 <th>Edit</th>
                  <th>Delete</th>
                     </tr>
                     </thead> 
                     <tbody>  ";
       while($row = mysql_fetch_array($result, MYSQL_ASSOC)) 
             {    
                  echo $row['sno']; // here not work
                    $sno=$row['sno'];
                     echo "<tr>";
                     echo "<td>" . $row['sno'] . "</td>";
                    echo "<td>" . $row['item_code'] . "</td>";
                     echo "<td>" . $row['product_name'] . "</td>";
                     echo "<td>" . $row['quantity'] . "</td>";
                    echo '<td><a href="edit_export.php?id='.$sno.'"> <img src="assets/img/icons/pencil.png" alt="Edit"></a></form></td>';
                    echo '<td> <form name="dform" action="delete_export.php?id='.$sno.'" method="POST" enctype="multipart/form-data">
                    <input type="submit"  value="Delete"   class="btn btn-primary"></input></form></td> ';
             echo "</tr>";
            }
            echo "</tbody></table>";
            mysql_close($con);
            ?>
 
     
    