<?php
include"../../../../inc/conn.php";

// CEK HAK AKSES DISINI

$id_unit		= str_replace("'","`",(isset($_POST['id_unit'])) ? $_POST['id_unit'] : "");
$id_pretest		= str_replace("'","`",(isset($_POST['id_pretest'])) ? $_POST['id_pretest'] : "");
$soal			= str_replace("'","`",(isset($_POST['soal'])) ? $_POST['soal'] : "");

$opsi_a			= str_replace("'","`",(isset($_POST['opsi_a'])) ? $_POST['opsi_a'] : "");
$opsi_b			= str_replace("'","`",(isset($_POST['opsi_b'])) ? $_POST['opsi_b'] : "");
$opsi_c			= str_replace("'","`",(isset($_POST['opsi_c'])) ? $_POST['opsi_c'] : "");
$opsi_d			= str_replace("'","`",(isset($_POST['opsi_d'])) ? $_POST['opsi_d'] : "");
$opsi_e			= str_replace("'","`",(isset($_POST['opsi_e'])) ? $_POST['opsi_e'] : "");


$update = mysqli_query($connect,"update tb_pretest set 

		soal			= '".$soal."',

		opsi_a			= '".$opsi_a."',
		opsi_b			= '".$opsi_b."',
		opsi_c			= '".$opsi_c."',
		opsi_d			= '".$opsi_d."',
		opsi_e			= '".$opsi_e."'
		
	where id_pretest='$id_pretest'")or die(mysqli_error($connect));


if($update){
	echo"<script>alert('Soal pretest berhasil diperbarui !');</script>";
	echo"<script>document.location.href='index.php?prefix=pretest&unit=$id_unit'</script>";
}else{
	echo"<script>alert('Gagal mengeksekusi perintah ini !');history.go(-1)</script>";
}
?>