<!DOCTYPE html>
<html>
<head>
   <title>Live Search using AJAX</title>
   <!-- Including jQuery is required. -->
   <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
   <!-- Including our scripting file. -->
   <script type="text/javascript" src="scripts6.js"></script>
   <script type="text/javascript" src="date.js"></script>
   <script type="text/javascript">
function SetDate()
{
var date = new Date();

var day = date.getDate();
var month = date.getMonth() + 1;
var year = date.getFullYear();

if (month < 10) month = "0" + month;
if (day < 10) day = "0" + day;

var today = year + "-" + month + "-" + day;


document.getElementById('theDate').value = today;
}
</script>




   <!-- Including CSS file. -->
   <link rel="stylesheet" type="text/css" href="style.css">

   <link rel="stylesheet" href="main.css">


   <script type="text/javascript" src="search6.js"></script>
</head>
<body onload="SetDate();">

  <?php
  if ($_SERVER["REQUEST_METHOD"] == "POST") {

    require 'db.php';

    $current_date = date("Y-m-d");
    // code...
    $sql = "INSERT INTO checking (CheckingName, CheckingDate, CheckingIn)
              VALUES ('" . mysqli_escape_string($con, $_POST['CheckingName']) . "', '"
                          . mysqli_escape_string($con, $_POST['CheckingDate']) . "','"
                          . mysqli_escape_string($con, $_POST['CheckingIn']) . "')";

    $results = mysqli_query($con, $sql);

    if ($results === false) {
      echo mysqli_error($con);
    } else {

      $id = mysqli_insert_id($con);
       echo "Inserted recond with $id";
    }


  }

   ?>


<!-- Search box. -->
<form  method="post">

<div class="field">
<label for="search">Search</label>
   <input name="CheckingName" type="text" id="search" placeholder="Search" />
   </div>

   <div class="field">
      <input name="CheckingDate" type="date" id="theDate" placeholder="Search" />
      </div>

    <div class="field">
         <input name="CheckingIn" type="time" id="searchere" placeholder="Search" />
         </div>

   <div class="field"><button>CHECK IN</button></div>

   </form>

      <!-- Suggestions will be displayed in below div. -->
  <div class="field" id="display"></div>




</body>
</html>
