<div id="ld" style="position:fixed; top:50%; left:50%"><img src="img/ld.gif"></div>			


<?php
	
	include "php_class/class_mysql.php";
	include "php_class/class_semesterpendek.php";
	
	$datasp = new DataSemesterPendek;
	$datasp2 = new DataSemesterPendek;
	
	$jumlah = $_POST['jumlah'];
	$idmatkul = $_POST['idmatkul'];
	$tahun = $_SESSION['smtahun'];
	$semester = $_SESSION['smsemester'];
	$program = $_SESSION['smprogram'];
	
	$datasp2->delete_tempbagi($idmatkul, $tahun, $semester, $program);
	
	$JumlahData = $datasp->get_matkul_sempek_mhs('',$a,'jumlah', $program, $tahun, $semester, $idmatkul);
		$kelas = 1;	
		$bagi = $JumlahData / $jumlah;
		$tambah = $bagi;	
		
		for ($a=1;$a<=$JumlahData;$a++){
			$nama = $datasp->get_matkul_sempek_mhs('Nama',$a,'', $program, $tahun, $semester, $idmatkul);
			$NPM = $datasp->get_matkul_sempek_mhs('NPM',$a,'', $program, $tahun, $semester, $idmatkul);

			if($a > $tambah and $kelas < $jumlah){
				$kelas = $kelas +1;
				$tambah = $tambah + $bagi;
			}
			$datasp->add_temp_bagi($NPM, $idmatkul, $tahun, $semester, $program, $kelas);
		}

?>
<script>window.location='bagi-kelas-lanjutan/<?php echo $idmatkul?>/<?php echo $jumlah?>'</script>