<?php
session_start();
include '../koneksi.php';
include '../admin/layout_header.php';

$id_user = $_SESSION['id_user'];
$query = mysqli_query($koneksi, "SELECT * FROM master_guru WHERE id_guru = '$id_user'");
$data = mysqli_fetch_array($query);
?>

<div class="container-fluid">
    <h3>Edit Profil</h3>
    <form action="proses_edit.php" method="POST" enctype="multipart/form-data">
        <div class="form-group mb-3">
            <label>Nama Lengkap</label>
            <input type="text" name="nama" class="form-control" value="<?= $data['nama']; ?>" required>
        </div>
        <div class="form-group mb-3">
            <label>Foto Profil</label><br>
            <?php if(!empty($data['foto'])) { echo "<img src='../assets/foto/".$data['foto']."' width='100'><br>"; } ?>
            <input type="file" name="foto" class="form-control">
            <small>Kosongkan jika tidak ingin mengubah foto.</small>
        </div>
        <button type="submit" class="btn btn-primary">Simpan Perubahan</button>
    </form>
</div>
<?php include '../admin/layout_footer.php'; ?>