<html>
    <head>
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
                <script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
        <link rel='stylesheet' href='https://cdn.datatables.net/1.10.21/css/dataTables.bootstrap4.min.css'>
        <link rel='stylesheet' href='https://cdn.datatables.net/buttons/1.6.2/css/buttons.dataTables.min.css'>
    </head>
    <body>
        <br><br>
        <h3 style='margin:0 auto;text-align:center'>F45 Event 3 Summary</h3>
        <br><br>
        <div class='col-md-10' style='margin:0 auto'>
            <table style='' class='table table-bordered table-stripped'>
            <thead>
            <tr>
                <th>#</th>
                <th>Name</th>
                <th>Surename</th>
                <th>Email</th>
                <th>Phone</th>
                <th>Location</th>
                <th>Date</th>
                <th>Attendance</th>
            </tr>
            </thead>
            <tbody>
            <?php
$conn = mysqli_connect("localhost", "f45_form","f45_form", "f45_form");
    // Check connection

 
    $sql = "SELECT * FROM `event3` ORDER BY `id` ASC";

    if ($conn->connect_error) {
          die("Connection failed: " . $conn->connect_error);
        }
        
        $sql = "select * from event3";
        $result = $conn->query($sql);
        
        while($row = $result->fetch_assoc()) {
            echo "<tr>";
            echo "<td>".$row['id']."</td>";
            echo "<td>".$row['name']."</td>";
            echo "<td>".$row['surename']."</td>";
            echo "<td>".$row['email']."</td>";
            echo "<td>".$row['phone']."</td>";
            echo "<td>".$row['location']."</td>";
            echo "<td>".$row['created_at']."</td>";
            echo "<td align='center'><input type='checkbox' style='transform: scale(2); margin-top:25px;'></td>";
            echo "</tr>";
          }
        $conn->close();

?>      </tbody>
        </table>
        <br><br>
        </div>
        <script>
            $(document).ready(function(){
                $('table').DataTable( {
                    dom: 'Bfrtip',
                    buttons: [
                        'print'
                    ]
                } );
            });
        </script>
        
        <script src='https://cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js'></script>
        <script src='https://cdn.datatables.net/1.10.21/js/dataTables.bootstrap4.min.js'></script>
        <script src='https://cdn.datatables.net/buttons/1.6.2/js/dataTables.buttons.min.js'></script>
        <script src='https://cdn.datatables.net/buttons/1.6.2/js/buttons.print.min.js'></script>
        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
    </body>
</html>
