<?php
session_start();
if($_SESSION['id_siswa']!=''){
include"../inc/conn.php";

$id_siswa   = str_replace("'","`",(isset($_POST['id_siswa'])) ? $_POST['id_siswa'] : "");
$id_unit    = str_replace("'","`",(isset($_POST['id_unit'])) ? $_POST['id_unit'] : "");
$id_umpanbalik   = str_replace("'","`",(isset($_POST['id_umpanbalik'])) ? $_POST['id_umpanbalik'] : "");
$jawaban   = str_replace("'","`",(isset($_POST['jawaban'])) ? $_POST['jawaban'] : "");


$count = count($id_umpanbalik);
for($i=0;$i<$count;$i++){


  $simpan = mysqli_query($connect,"insert into tb_jawaban_umpanbalik set

    id_siswa        = '".$id_siswa."',
    id_unit         = '".$id_unit."',
    id_umpanbalik   = '".$id_umpanbalik[$i]."',
    jawaban         = '".$jawaban[$i]."'") or die(mysqli_error($connect));

}

echo"<script>alert('Terimakasih telah memberikan umpan balik !');</script>";
echo"<script>document.location.href='umpanbalik.php?id=$id_unit'</script>";



}else{
  echo"<script>document.location.href='index.php'</script>";
}
?>