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

 <?php include 'head.php';?>

<body>

  <!-- ======= Header ======= -->
  
 <?php include 'menubar.php';?>

 <?php include 'sidebar.php';?>


  <main id="main" class="main">

<!DOCTYPE html>
<html>
<head>
    <title>Student Registration Form</title>
    <link rel="stylesheet" type="text/css" href="styles.css">
	<style>
	body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
}

h1 {
    text-align: center;
}

form {
    max-width: 500px;
    margin: 0 auto;
}

label {
    display: block;
    margin-top: 10px;
}

input[type="text"],
input[type="date"],
input[type="tel"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

input[type="submit"] {
    background-color: #4CAF50;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    float: right;
}

input[type="submit"]:hover {
    background-color: #45a049;
}
</style>
</head>
<body>

    <h1>Create New Batch</h1>
    <form action="batch_submit.php" method="POST">
	  <label for="fees_deposit_date">New Batch Name</label>
        <input type="text" id="batch_name" name="batch_name" required><br>
	
	    <label for="fees_deposit_date">New Batch Time</label>
        <input type="text" id="batch_time" name="batch_time" required><br>


        <input type="submit" value="Submit">
    </form>


</body>
</html>
<!DOCTYPE html>
<html>
<head>
    <title>Batch Data</title>
</head>
<body>
    <h1>Batch Data</h1>

    <?php
    // Database connection parameters
   $servername = "localhost";
$username = "tslibrary_user";
$password = "rb!tsl838";
$dbname = "tslibrary_data";

    try {
        // Create a connection to the database
        $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
        $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

        // SQL query to select data from the 'batch' table
        $sql = "SELECT ID, batch_name, batch_time FROM batch";
        $stmt = $conn->prepare($sql);
        $stmt->execute();

        // Fetch and display the data in an HTML table
        echo "<table border='1'>";
        echo "<tr><th>ID</th><th>Batch Name</th><th>Batch Time</th></tr>";
        while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
            echo "<tr>";
            echo "<td>{$row['ID']}</td>";
            echo "<td>{$row['batch_name']}</td>";
            echo "<td>{$row['batch_time']}</td>";
            echo "</tr>";
        }
        echo "</table>";

        // Close the database connection
        $conn = null;
    } catch (PDOException $e) {
        echo "Error: " . $e->getMessage();
    }
    ?>

</body>
</html>

  </main><!-- End #main -->

   <?php include 'footer.php';?>

</body>

</html>