<?php
session_start();
$conn = mysqli_connect('localhost', 'ahmeuesz_dino', 'X39IW2ho3^5h6d_5', 'ahmeuesz_myapp');

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $date = $_POST['date'];
    $fajar = $_POST['fajar'];
    $zuhar = $_POST['zuhar'];
    $asar = $_POST['asar'];
    $mghrib = $_POST['mghrib'];
    $esha = $_POST['esha'];
    $name = $_SESSION['name'];

    $sql = "INSERT INTO namaz_table (name, date, fajar, zuhar, asar, mghrib, esha)
            VALUES ('$name', '$date', '$fajar', '$zuhar', '$asar', '$mghrib', '$esha')";
    if (mysqli_query($conn, $sql)) {
        header('Location: display.php?msg=success');
    } else {
        header('Location: display.php?msg=error');
    }
    exit();
}
?>
