<?php
include('constant/connect.php');

$name = $_POST['patient_name'];
$phone = $_POST['phone'];
$doctor = $_POST['doctor_id'];
$date = $_POST['date'];
$time = $_POST['time'];

$status = "approved"; // admin added = direct approved

$sql = "INSERT INTO appointments 
(patient_name, phone, doctor_id, date, time, status)
VALUES ('$name','$phone','$doctor','$date','$time','$status')";

if($connect->query($sql)){
    header("Location: appointment_list.php?added=1");
}else{
    echo "Error: " . $connect->error;
}
?>