<?php
require("../../config/koneksi.php");
require("../../config/function.php");
if (isset($_POST['id'])) {
	$idu = $_POST['id'];
	$mapelQ = mysqli_query($koneksi, "SELECT * from jawaban WHERE id_ujian='$idu' ");

	while ($jawab = mysqli_fetch_array($mapelQ)) {
		$jawab_essai = addslashes($jawab['esai']);
		$exec = mysqli_query($koneksi, "INSERT INTO hasil_jawaban (id_siswa,id_bank,id_soal,jawaban,jenis,esai,nilai_esai,ragu,id_ujian,jawabx,jawabmulti,jawabbs,jawaburut,bs1,bs2,bs3,bs4,bs5,urut1,urut2,urut3,urut4,urut5)VALUES('$jawab[id_siswa]','$jawab[id_bank]','$jawab[id_soal]','$jawab[jawaban]','$jawab[jenis]','$jawab_essai','$jawab[nilai_esai]','$jawab[ragu]','$jawab[id_ujian]','$jawab[jawabx]','$jawab[jawabmulti]','$jawab[jawabbs]','$jawab[jawaburut]','$jawab[bs1]','$jawab[bs2]','$jawab[bs3]','$jawab[bs4]','$jawab[bs5]','$jawab[urut1]','$jawab[urut2]','$jawab[urut3]','$jawab[urut4]','$jawab[urut5]')");
	}
	$exec = mysqli_query($koneksi, "DELETE FROM jawaban WHERE id_ujian='$idu'");
} else {
	exit('Anda tidak dizinkan mengakses langsung script ini!');
}
