<form id="editReportForm" action="update_report.php" method="POST" enctype="multipart/form-data">
    <input type="hidden" name="id" value="<?php echo htmlspecialchars($row['id']); ?>">
    <div class="form-group">
        <label for="division">Division</label>
        <select id="division" name="division" required>
            <option value="">Pilih Division</option>
            <?php foreach ($divisions as $division): ?>
                <option value="<?php echo htmlspecialchars($division); ?>" <?php echo ($division == htmlspecialchars($row['division'])) ? 'selected' : ''; ?>>
                    <?php echo htmlspecialchars($division); ?>
                </option>
            <?php endforeach; ?>
        </select>
    </div>
    <div class="form-group">
        <label for="block">Block</label>
        <select id="block" name="block" required>
            <option value="">Pilih Block</option>
            <?php foreach ($blocks as $block): ?>
                <option value="<?php echo htmlspecialchars($block); ?>" <?php echo ($block == htmlspecialchars($row['block'])) ? 'selected' : ''; ?>>
                    <?php echo htmlspecialchars($block); ?>
                </option>
            <?php endforeach; ?>
        </select>
    </div>
    <div class="form-group">
        <label for="kj">Tipe KJ</label>
        <select id="kj" name="kj" required>
            <option value="kj1" <?php echo ($row['kj'] == 'kj1') ? 'selected' : ''; ?>>KJ1</option>
            <option value="kj2" <?php echo ($row['kj'] == 'kj2') ? 'selected' : ''; ?>>KJ2</option>
            <option value="kj3" <?php echo ($row['kj'] == 'kj3') ? 'selected' : ''; ?>>KJ3</option>
            <option value="kj4" <?php echo ($row['kj'] == 'kj4') ? 'selected' : ''; ?>>KJ4</option>
        </select>
    </div>
    <div class="form-group">
        <label for="damageType">Jenis Kerusakan</label>
        <input type="text" id="damageType" name="damageType" value="<?php echo htmlspecialchars($row['damageType']); ?>" required>
    </div>
    <div class="form-group">
        <label for="classification">Klasifikasi Kubangan</label>
        <input type="text" id="classification" name="classification" value="<?php echo htmlspecialchars($row['classification']); ?>" required>
    </div>
    <div class="form-group">
        <label for="mitigationPlan">Rencana Penanggulangan</label>
        <textarea id="mitigationPlan" name="mitigationPlan" required><?php echo htmlspecialchars($row['mitigationPlan']); ?></textarea>
    </div>
    <div class="form-group">
        <label for="notes">Catatan</label>
        <textarea id="notes" name="notes" required><?php echo htmlspecialchars($row['notes']); ?></textarea>
    </div>
    <div class="form-group">
        <label for="initialPhoto">Foto Awal</label>
        <input type="file" id="initialPhoto" name="initialPhoto" accept="image/*">
        <p>Foto saat ini: <a href="<?php echo htmlspecialchars($row['initialPhoto']); ?>" target="_blank">Lihat Foto</a></p>
    </div>
    <div class="form-group">
        <label for="updatedPhoto">Foto Pembaruan</label>
        <input type="file" id="updatedPhoto" name="updatedPhoto" accept="image/*">
        <p>Foto saat ini: <a href="<?php echo htmlspecialchars($row['updatedPhoto']); ?>" target="_blank">Lihat Foto</a></p>
    </div>
    <div class="form-group">
        <label for="status">Status</label>
        <select id="status" name="status" required>
            <option value="belum ditanggani" <?php echo ($row['status'] == 'belum ditanggani') ? 'selected' : ''; ?>>Belum Ditanggani</option>
            <option value="sedang ditanggani" <?php echo ($row['status'] == 'sedang ditanggani') ? 'selected' : ''; ?>>Sedang Ditanggani</option>
            <option value="selesai" <?php echo ($row['status'] == 'selesai') ? 'selected' : ''; ?>>Selesai</option>
        </select>
    </div>
    <button type="submit" class="btn btn-primary">Update Data</button>
</form>