<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="form.css">
  <!-- <link rel="stylesheet" href="table.css"> -->
  <link rel="stylesheet" href="main12.css">
  <title>View all Attendees</title>
  <link rel="stylesheet" href="tableview.css">
</head>
<body>
<?php

require 'db.php';
$date= $_POST['date'];




// echo "Haha.. Connected successfully";
$sql = "SELECT *
FROM childrencheckin WHERE CheckingDate = '$date'" ;

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

if ($results === false) {
  // code...
  echo mysqli_error($con);
} else {
  // code...
  $viewAttendees= mysqli_fetch_all($results, MYSQLI_ASSOC);


}
 ?>

  <?php require 'header.php'; ?>
    
       <?php if (empty($viewAttendees)):?>
         <p>No Attendeesn found</p>
       <?php else: ?>
       
        <p>List of attendance for <?php echo $_POST['date']; ?></p>
         <?php foreach ($viewAttendees as $attendees):  ?>

         <table id="Attendees"><ul>
           <tr>
             <th>Name</th>
             <th> Date</th>
             <th> Time</th>
           </tr>

           <tr>
             <td><?= $attendees['CheckingName'] ?></td>
             <td><?= $attendees['CheckingDate'] ?></td>
             <td><?= $attendees['CheckingIn'] ?></td>
           </tr>
         </table>
       <?php endforeach; ?>
       </ul>
     <?php endif; ?>
<br>
     <div>
        Make another Search: <?php
        include 'AttendeesSearchByDate.php'
        ?>
     </div>

     <?php require 'footer.php' ?>

</body>
</html>
