

<!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>

<script >
   function SetTime() {
   setInterval(function() {
    var currentTime = new Date ( );    
    var currentHours = currentTime.getHours ( );   
    var currentMinutes = currentTime.getMinutes ( );   
    var currentSeconds = currentTime.getSeconds ( );
    currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;   
    currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;    
    var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";    
    currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;    
    currentHours = ( currentHours == 0 ) ? 12 : currentHours;    
    var currentTimeString = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;
    document.getElementById("timer").innerHTML = currentTimeString;
}, 1000);
   }

</script>




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

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


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

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

    include '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 '<span style="color:green;text-align:center;">successfully check in</span>';
    }


  }

   ?>


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

< class="field">
<center><label for="Enter your phone Number">Enter your Phone Number.</label></center>
<label for="">After enter your number, if your name does not show up contact Pastor.</label>
<hr></hr>
   <input name="CheckingName" type="text" id="search" placeholder="Enter your Number" />
   </div>

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

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

</div>

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

   </form>

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




</body>
</html>
