<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Edit User</title>
    <script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-gray-100">
<?php include "header.php;"?>
    <div class="flex h-screen">
        <!-- Sidebar -->
        <?php include "side_bar.php";?>
        
        <!-- Main Content -->
        <!-- Main Content -->
        <main class="flex-1 p-6 md:ml-64">
    <!-- Top Navigation -->
     <div class="container">
           <h2 class="text-2xl font-bold text-gray-700 mb-4">Edit User</h2>

                    <!-- Assume we have a function to fetch the user info from the database -->
                    <?php
                    // Fetch user details from the database
                    // Assuming you're getting the user ID from the URL parameter
                    $user_id = $_GET['id'];  // Example: edit_user.php?id=1

                    // Here you can run a database query to fetch the user data
                    // Example: $user = getUserDetails($user_id);

                    // For demonstration, using a static array
                    $user = [
                        'username' => 'JohnDoe',
                        'email' => 'johndoe@example.com',
                        'password' => 'password123'
                    ];
                    ?>

                    <!-- Edit User Form -->
                    <form action="update_user.php" method="POST" class="bg-white p-6 rounded-lg shadow-md w-full">
                        <input type="hidden" name="user_id" value="<?php echo $user_id; ?>">

                        <label for="username" class="block text-gray-700">Username:</label>
                        <input type="text" id="username" name="username" value="<?php echo $user['username']; ?>" required class="w-full p-2 border border-gray-300 rounded-md mb-4">

                        <label for="email" class="block text-gray-700">Email:</label>
                        <input type="email" id="email" name="email" value="<?php echo $user['email']; ?>" required class="w-full p-2 border border-gray-300 rounded-md mb-4">

                        <label for="password" class="block text-gray-700">Password:</label>
                        <input type="password" id="password" name="password" value="<?php echo $user['password']; ?>" class="w-full p-2 border border-gray-300 rounded-md mb-4">

                        <button type="submit" class="bg-[#CD7F32] text-white px-6 py-2 rounded-md">Update User</button>
                    </form>
                </div>
            </div>

            <!-- End of Dashboard Cards -->
        </main>
    </div> <!-- End of Flex Container -->
    <?php include "footer.php";?>
</body>
</html>
