

<?php
// Connect to the database (you need to replace these values with your actual database details)
$servername = "localhost";
$username = "tslibrary_user";
$password = "rb!tsl838";
$dbname = "tslibrary_data";

$conn = new mysqli($servername, $username, $password, $dbname);

if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $batch_name= $_POST["batch_name"];
    $batch_time = $_POST["batch_time"];
    
	
    $sql = "INSERT INTO batch (batch_name,batch_time)
            VALUES ('$batch_name', '$batch_time')";

    if ($conn->query($sql) === TRUE) {
        echo "New record inserted successfully";
    } else {
        echo "Error: " . $sql . "<br>" . $conn->error;
    }
}
header("Location: batch_registraion.php");
exit();
$conn->close();
?>
