<h2>Soal Ujian Komprehensif</h2>

<?php if (isset($soal) && is_array($soal) && count($soal) > 0): ?>
    <form method="POST" action="/dashboard/mahasiswa-reg-kompre/simpan-jawaban">
        <?php foreach ($soal as $index => $s): ?>
            <div>
                <p><strong><?= ($index + 1) ?>. <?= $s['pertanyaan'] ?></strong></p>
                <label><input type="radio" name="jawaban[<?= $s['id_kompre'] ?>]" value="a" required> A. <?= $s['pilihan_a'] ?></label><br>
                <label><input type="radio" name="jawaban[<?= $s['id_kompre'] ?>]" value="b" required> B. <?= $s['pilihan_b'] ?></label><br>
                <label><input type="radio" name="jawaban[<?= $s['id_kompre'] ?>]" value="c" required> C. <?= $s['pilihan_c'] ?></label><br>
                <label><input type="radio" name="jawaban[<?= $s['id_kompre'] ?>]" value="d" required> D. <?= $s['pilihan_d'] ?></label><br>
                <?php if (!empty($s['pilihan_e'])): ?>
                    <label><input type="radio" name="jawaban[<?= $s['id_kompre'] ?>]" value="e" required> E. <?= $s['pilihan_e'] ?></label><br>
                <?php endif; ?>
            </div>
            <hr>
        <?php endforeach; ?>
        <button type="submit">Selesai Ujian</button>
    </form>
<?php else: ?>
    <p><em>Tidak ada soal yang tersedia untuk ditampilkan.</em></p>
<?php endif; ?>
