<?php
include "../koneksi.php";

$id = $_GET['id'];
$data = mysqli_query($conn, "SELECT * FROM ustadz WHERE id='$id'");
$u = mysqli_fetch_assoc($data);
?>

<!DOCTYPE html>
<html>
<head>
<title>Edit Ustadz</title>

<style>
body{
    font-family:Arial, sans-serif;
    background:#f3f4f6;
    margin:0;
    min-height:100vh;
    display:flex;
    justify-content:center;
    align-items:center;
}

.card{
    width:100%;
    max-width:600px;
    background:#fff;
    padding:30px;
    border-radius:16px;
    box-shadow:0 10px 30px rgba(0,0,0,.1);
}

.form-group{ margin-bottom:16px; }

label{ font-weight:bold; display:block; margin-bottom:6px; }

input, textarea{
    width:100%;
    padding:10px;
    border-radius:10px;
    border:1px solid #d1d5db;
}

.btn{
    padding:10px 16px;
    border:none;
    border-radius:10px;
    cursor:pointer;
}

.btn-simpan{ background:#3b82f6; color:#fff; }
.btn-kembali{ background:#e5e7eb; margin-left:10px; text-decoration:none; }
</style>
</head>

<body>

<div class="card">
<h2>Edit Ustadz</h2>

<form action="ustadz_proses_edit.php" method="post">
<input type="hidden" name="id" value="<?= $u['id']; ?>">

<div class="form-group">
    <label>Nama Ustadz</label>
    <input type="text" name="nama" value="<?= $u['nama']; ?>" required>
</div>

<div class="form-group">
    <label>Bidang</label>
    <input type="text" name="bidang" value="<?= $u['bidang']; ?>" required>
</div>

<div class="form-group">
    <label>Alamat</label>
    <textarea name="alamat" required><?= $u['alamat']; ?></textarea>
</div>

<button class="btn btn-simpan">Update</button>
<a href="ustadz.php" class="btn-kembali">Kembali</a>
</form>

</div>

</body>
</html>
