<?php
include 'db_connection.php'; // Include your database connection

session_start();
$studentId = $_SESSION['student_id'];

$stmt = $conn->prepare("SELECT * FROM profiles WHERE student_id = ?");
$stmt->bind_param("i", $studentId);
$stmt->execute();
$result = $stmt->get_result();
$profile = $result->fetch_assoc();
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Edit Profile</title>
</head>
<body>
    <form method="post" action="update_profile.php" enctype="multipart/form-data">
        <label for="name">Name:</label>
        <input type="text" name="name" id="name" value="<?php echo htmlspecialchars($profile['name']); ?>" required>
        
        <label for="profile_picture">Profile Picture:</label>
        <input type="file" name="profile_picture" id="profile_picture">
        
        <label for="bio">Bio:</label>
        <textarea name="bio" id="bio"><?php echo htmlspecialchars($profile['bio']); ?></textarea>
        
        <button type="submit">Update Profile</button>
    </form>
</body>
</html>
