 <?php  
 session_start();
include './../koneksi.php'; 
include ('./../cek_login.php');    
ini_set('display_errors',1);
error_reporting(E_ALL);
      
if(isset($_POST)) {
     
$checked_array = $_POST['no'];
foreach ($_POST['id'] as $key => $value) 
{

    if(in_array($_POST['id'][$key], $checked_array))
    {
    $id         = $_POST['id'][$key];
    $nim         = $_POST['nim'][$key];
    $no_bukti     = "KM".$_SESSION['nokode'].date("YmdHis");
    $tglmasehi  = $_POST['tglmasehi'][$key];
    $tgl        = date('Y-m-d');
    $kls        = $_POST['kls'][$key];    
    $tahun      = $_POST['tahun'][$key];
    $kewajiban  = str_replace(",", "",$_POST['kewajiban'])[$key];
    $username   =  $_SESSION['username'];
    $dataTable  = $_POST['dataTable'];
    
  
    mysqli_query($koneksi,'INSERT INTO bulanan(no,id,nim,no_bukti,tglmasehi,tgl,no_kls,tahun,  kewajiban,keterangan,username,koreksi)
VALUES (
"NULL",
"' . $id. '",
"' . $nim. '",
"' . $no_bukti. '",
"' . $tglmasehi. '",
"' . $tgl. '",
"' . $kls. '",
"' . $tahun. '",
"' . $kewajiban. '",
" Buat Tagihan Syariah",
"' . $username. '",
"' . $username. '"

)'
)
or die(mysqli_errno($koneksi).':'.mysqli_error($koneksi));
   
    echo "Data Berhasil Disimpan";
}
   
   } 
    
    }
?>