Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. From date: <input type="text" id="fromdate" value=""> To date: <input type="text" id="todate" value="" onChange="showuser(document.getElementById('fromdate').value,document.getElementById('todate').value)">
  2. <br>
  3. <div id="txtHint"><b>User informathions will be listed here.</b></div>
  4.  
  5. <script>
  6. $(function() {
  7. $( "#fromdate" ).datepicker();
  8. $( "#todate" ).datepicker();
  9. });
  10. </script>
  11.  
  12. <script type="text/javascript">
  13. function showUser(fromdate,todate)
  14. {
  15. if (fromdate =="" && todate=="")
  16. {
  17. document.getElementById("txtHint").innerHTML="";
  18. return;
  19. }
  20.  
  21. if (window.XMLHttpRequest)
  22. {// code for IE7+, Firefox, Chrome, Opera, Safari
  23. xmlhttp=new XMLHttpRequest();
  24. }
  25. else
  26. {// code for IE6, IE5
  27. xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  28. }
  29.  
  30. xmlhttp.onreadystatechange=function()
  31. {
  32. if (xmlhttp.readyState==4 && xmlhttp.status==200)
  33. {
  34. document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
  35. }
  36. }
  37. xmlhttp.open("GET","bet_date.php?fromdate="+fromdate+"&todate="+todate,true);
  38. xmlhttp.send();
  39. }
  40. </script>
  41.  
  42. include("database.php");
  43. $fromdate=$_GET["fromdate"];
  44. $todate=$_GET["todate"];
  45. $sql = "SELECT * FROM bookings WHERE date between '$fromdate' and '$todate'";
  46. $result = mysql_query($sql);
  47.  
  48. echo "<table border='1'>
  49. <tr>
  50. <th>id</th>
  51. <th>date</th>
  52. <th>start</th>
  53. <th>name</th>
  54. <th>email</th>
  55. <th>phone</th>
  56. <th>comments</th>
  57. <th>approved</th>
  58. </tr>";
  59.  
  60. while($row = mysql_fetch_array($result))
  61. {
  62. echo "<tr>";
  63. echo "<td>" . $row['id'] . "</td>";
  64. echo "<td>" . $row['date'] . "</td>";
  65. echo "<td>" . $row['start'] . "</td>";
  66. echo "<td>" . $row['name'] . "</td>";
  67. echo "<td>" . $row['email'] . "</td>";
  68. echo "<td>" . $row['phone'] . "</td>";
  69. echo "<td>" . $row['comments'] . "</td>";
  70. echo "<td>" . $row['approved'] . "</td>";
  71. echo "</tr>";
  72. }
  73. echo "</table>";
  74.  
  75. "SELECT * FROM bookings WHERE date(date) between '$fromdate' and '$todate'";
  76.  
  77.  
  78. From date: <input type="text" id="fromdate" value="" onChange="showUser()"> To date: <input type="text" id="todate" value="" onChange="showUser()">
  79.  
  80. function showUser()
  81. {
  82.  
  83. var fromdate = $( "#fromdate" ).val();
  84. var todate= $( "#todate" ).val();
  85.  
  86. // rest of your code:
  87.  
  88.  
  89.  
  90.  
  91. }
  92.  
  93. I have Created Whole Tutorial for Date Wise Report, so once try it
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement