<?php

session_start(); 
    $u_uname = '';
    if (isset($_COOKIE['auth_token']))
    {
        $u_uname = $_COOKIE['auth_token'];
    }else{
        header("location:../login.php");
    }

    include '../include/connection.php';

    $holidayName = $_POST['holidayName'];
    $holidayDate = $_POST['holidayDate'];

    $sql = "INSERT INTO `holiday`(`holidayName`, `holidayDate`) VALUES('$holidayName', '$holidayDate')";
    $result = $link->query($sql);
    
    if($result){
        header('Location:../allholidays.php?status=1');
    }
    else{
        echo "Error inserting the holiday";
    }
?>