<?php
include('connection.php');

if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $holiday_from = $_POST["holiday_from"];
    $holiday_to = $_POST["holiday_to"];
    $title = $_POST["title"];
    $currentDateTime = date('Y-m-d H:i:s');

    $insertSql = "INSERT INTO add_holiday (holiday_from, holiday_to, title,datetime) VALUES ('$holiday_from', '$holiday_to', '$title','$currentDateTime')";

    if (mysqli_query($conn, $insertSql)) {

        header("Location: add-holiday.php?success=Holiday Added Successfully!!!");
        exit();   
    } else {
      
        echo "Error: " . mysqli_error($conn);
    }
}
?>