<?php
require("../../../config/koneksi.php");
require("../../../config/function.php");
require("../../../config/crud.php");

	$tanggal=date('Y-m-d');
	$kelas = $_POST['kelas'];
	$mapel = $_POST['mapel'];
	$guru = $_POST['guru'];
	$mapelQ = mysqli_query($koneksi, "SELECT * from siswa_ptm
	JOIN absensi ON absensi.idsiswa = siswa_ptm.id_siswa 
	
	WHERE siswa_ptm.id_kelas='$kelas' AND absensi.tanggal='$tanggal'");

	while ($tarik = mysqli_fetch_array($mapelQ)) {
		
		$exec = mysqli_query($koneksi, "INSERT INTO absen_mapel (tanggal,ket,guru,idsiswa,mapel,kelas,blth)VALUES('$tarik[tanggal]','$tarik[ket]','$guru','$tarik[id_siswa]','$mapel','$kelas','$tarik[blth]')");
	}
	

?>
