<?php
include '../../db_connect.php';

$id = $_GET['id'];
$sql = "SELECT * FROM appointments WHERE id = $id";
$result = $conn->query($sql);
$appointment = $result->fetch_assoc();
?>

<?php
include "../layout/header.php";
?>
        <h2 class="text-center">View Appointment</h2>
        <div class="card">
            <div class="card-body">
                <p><strong>Name:</strong> <?= $appointment['name'] ?></p>
                <p><strong>Phone:</strong> <?= $appointment['phone'] ?></p>
                <p><strong>Message:</strong> <?= $appointment['message'] ?></p>
                <p><strong>Created At:</strong> <?= $appointment['created_at'] ?></p>
                <p><strong>Updated At:</strong> <?= $appointment['updated_at'] ?></p>
                <a href="index.php" class="btn btn-primary">Back to List</a>
            </div>
        </div>
    </div>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</body>
</html>

<?php $conn->close(); ?>
