<?php
session_start();
require 'config/db.php';

if(!isset($_SESSION['manager_id'])) die('Unauthorized');

$stmt = $pdo->prepare("
INSERT INTO manager_attendance_requests 
(manager_id, department, att_date, requested_status, reason)
VALUES (?,?,?,?,?)
");

$stmt->execute([
    $_SESSION['manager_id'],
    $_SESSION['department'],
    $_POST['att_date'],
    'Present',
    $_POST['reason']
]);

header("Location: manager_request_attendance.php?success=1");
