<?php 
include('includes/config.php');

?>


<?php
include('includes/user_data.php');

?>
<?php
if(isset($_POST['bankd']))
  {
$bank=$_POST['bank'];

   $sql = "INSERT INTO bank (id, email, details)
              VALUES ('', '$user_email', '$bank')";
              if (mysqli_query($conn, $sql)) 
              {
                  $msg="Profile Updated Successfully";
              }else{
                  $msg="Error occur"; 
              }


}

?>

<!doctype html>
<html lang="en">


<!-- Mirrored from codervent.com/rocker/demo/vertical/user-profile.html by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 26 Aug 2022 06:47:36 GMT -->
<head>
	<!-- Required meta tags -->
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<!--favicon-->
	<link rel="icon" href="assets/images/favicon-32x32.png" type="image/png" />
	<!--plugins-->
	<link href="assets/plugins/simplebar/css/simplebar.css" rel="stylesheet" />
	<link href="assets/plugins/perfect-scrollbar/css/perfect-scrollbar.css" rel="stylesheet" />
	<link href="assets/plugins/metismenu/css/metisMenu.min.css" rel="stylesheet" />
	<!-- loader-->
	<link href="assets/css/pace.min.css" rel="stylesheet" />
	<script src="assets/js/pace.min.js"></script>
	<!-- Bootstrap CSS -->
	<link href="assets/css/bootstrap.min.css" rel="stylesheet">
	<link href="assets/css/bootstrap-extended.css" rel="stylesheet">
	<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&amp;display=swap" rel="stylesheet">
	<link href="assets/css/app.css" rel="stylesheet">
	<link href="assets/css/icons.css" rel="stylesheet">
	<!-- Theme Style CSS -->
	<link rel="stylesheet" href="assets/css/dark-theme.css" />
	<link rel="stylesheet" href="assets/css/semi-dark.css" />
	<link rel="stylesheet" href="assets/css/header-colors.css" />
	<title> PENUEL COLLEGE </title>
	 <style>
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: 
#f2f2f2;
}

h1 {
    color: 
#333;
}

form {
    background-color: 
#fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 4px 
rgba(0, 0, 0, 0.1);
    max-width: 400px;
    margin: auto;
}

label {
    display: block;
    margin-bottom: 8px;
}

input[type="date"], button {
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    margin-bottom: 20px;
}

button {
    background-color: 
#4CAF50;
    color: 
white;
    border: none;
    cursor: pointer;
}

button:hover {
    background-color: 
#45a049;
}
    </style>
</head>

<body>
	<!--wrapper-->
	<div class="wrapper">
		<!--sidebar wrapper -->
		<?php include 'includes/side.php'; ?>
		<!--end sidebar wrapper -->
		<!--start header -->
		<?php include 'includes/head.php'; ?>
		<!--end header -->
		<!--start page wrapper -->
		<div class="page-wrapper">
			<div class="page-content">
			
			       <div class="section-title wow fadeInUp" data-wow-delay="0.1s" style="padding-top: 10px; text-align: center;">
                                  
                                   <span style="color:red;font-size: 20px;" >
                                      <?php if($_SESSION['errmsg']){
                                    echo htmlentities($_SESSION['errmsg']);
                                    ?>
                                    <?php
                                    echo htmlentities($_SESSION['errmsg']="");
									  }?>
                                    </span>

                                    <span style="color:green;font-size: 20px;" >
                                      <?php if($_SESSION['mess']){
                                    echo htmlentities($_SESSION['mess']);
                                    ?>
                                    <?php
                                    echo htmlentities($_SESSION['mess']="");
									  }?>
                                    </span>
                              </div>
			
            
			
			  <h1>Fetch Absent Students</h1>
    <form action="absent-students.php" method="post">
        <label for="date">Select Date:</label>
        <input type="date" id="date" name="date" required>
        <button type="submit">Fetch</button>
    </form>
			
			
			
			
			
			<!--fetch content-->
			
			<?php


if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $date = $_POST['date'];

    $sql = "SELECT students.name, students.parent_phone 
            FROM students 
            JOIN attendance ON students.id = attendance.student_id 
            WHERE attendance.date = ? AND attendance.status = 'absent'";

    if ($stmt = $conn->prepare($sql)) {
        $stmt->bind_param("s", $date);
        $stmt->execute();
        $result = $stmt->get_result();

        if ($result->num_rows > 0) {
            echo "<h2>Absent Students on $date</h2><ul>";
            while ($row = $result->fetch_assoc()) {
                echo "<li>" . htmlspecialchars($row['name']) . " - " . htmlspecialchars($row['phone']) . "</li>";
            }
            echo "</ul>";
        } else {
            echo "<p>No students were absent on this date.</p>";
        }

        $stmt->close();
    } else {
        echo "Error in preparing statement: " . $conn->error;
    }
}

$conn->close();
?>
			
			</div>
		</div>
		<!--end page wrapper -->
		<!--start overlay-->
		<div class="overlay toggle-icon"></div>
		<!--end overlay-->
		<!--Start Back To Top Button--> <a href="javaScript:;" class="back-to-top"><i class='bx bxs-up-arrow-alt'></i></a>
		<!--End Back To Top Button-->
		<footer class="page-footer">
			<p class="mb-0">Copyright © 2025. All right reserved.</p>
		</footer>
	</div>
	<!--end wrapper-->
	<!--start switcher-->
	<?php include 'includes/customiser.php'; ?>

	<!--end switcher-->
	<!-- Bootstrap JS -->
	<script src="assets/js/bootstrap.bundle.min.js"></script>
	<!--plugins-->
	<script src="assets/js/jquery.min.js"></script>
	<script src="assets/plugins/simplebar/js/simplebar.min.js"></script>
	<script src="assets/plugins/metismenu/js/metisMenu.min.js"></script>
	<script src="assets/plugins/perfect-scrollbar/js/perfect-scrollbar.js"></script>
	<!--app JS-->
	<script src="assets/js/app.js"></script>
</body>


<!-- Mirrored from codervent.com/rocker/demo/vertical/user-profile.html by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 26 Aug 2022 06:47:36 GMT -->
</html>

