<?php
require("../../config/koneksi.php");
require("../../config/function.php");
require("../../config/crud.php");
(isset($_GET['pg'])) ? $pg = $_GET['pg'] : $pg = '';

if ($pg == 'tambah') {


$ket = $_POST['ket'];	
$ids = $_POST['ids'];
$kelas = $_POST['kelas'];	
$mapel = $_POST['mapel'];	
$khp = $_POST['khp'];
$nilai = $_POST['nilai'];	

$count = count($_POST['kelas']);
$sql   = "INSERT INTO nilai_sumatif(idsiswa,mapel,kelas,ket,nilai,khp) VALUES ";
for( $i=0; $i < $count; $i++ )
{
$sql .= "('{$ids[$i]}','{$mapel[$i]}','{$kelas[$i]}','{$ket[$i]}','{$nilai[$i]}','{$khp[$i]}')";
$sql .= ",";
}
$sql = rtrim($sql,",");
$exec = $koneksi->query($sql);
echo "ok";
}
    if ($pg == 'tambah_sas') {


$ket = $_POST['ket'];	
$ids = $_POST['ids'];
$kelas = $_POST['kelas'];	
$mapel = $_POST['mapel'];	
$khp = $_POST['khp'];
$nilai = $_POST['nilai'];	

$count = count($_POST['kelas']);
$sql   = "INSERT INTO nilai_sumatif(idsiswa,mapel,kelas,ket,nilai,khp) VALUES ";
for( $i=0; $i < $count; $i++ )
{
$sql .= "('{$ids[$i]}','{$mapel[$i]}','{$kelas[$i]}','{$ket[$i]}','{$nilai[$i]}','{$khp[$i]}')";
$sql .= ",";
}
$sql = rtrim($sql,",");
$exec = $koneksi->query($sql);
echo "ok";
}