<button id="buttonHapus" >Hapus</button> <table> <thead> <tr> <th class="short">Cek</th> <th class="short">#</th> <th class="long">Nomor Induk Siswa</th> <th class="long">Nama</th> <th class="long">Kelas</th> <th>Action</th> </tr> </thead> <tbody> <?php include_once '../service/SiswaServiceImpl.php'; $siswaService = new SiswaServiceImpl(); $siswas = $siswaService->ambilSemuaSiswaDenganKelas(); $num = 1; foreach ($siswas as $siswa) { ?> <tr> <td><input type="radio" name="cek" id="cek"></td> <td><?php echo $num; ?> </td> <td style="text-align: right;padding-right: 20px;"><?php echo $siswa->getNomorSiswa(); ?> </td> <td><?php
<?php include_once '../service/SiswaServiceImpl.php'; include_once '../entity/Siswa.php'; include_once '../service/KelasServiceImpl.php'; $perintah = $_POST["perintah"]; $siswa = new Siswa(); $kelasService = new KelasServiceImpl(); $siswaService = new SiswaServiceImpl(); if ($perintah == "simpan") { $nama = $_POST["nama"]; $idKelas = $_POST["kelas"]; $kelasObj = $kelasService->ambilKelas($idKelas); $siswa->setNama($nama); $siswa->setKelas($kelasObj); $siswaService->simpanSiswa($siswa); } elseif ($perintah == "ubah") { $nama = $_POST["nama"]; $idKelas = $_POST["kelas"]; $nomorSiswa = $_POST["nomorSiswa"]; $kelasObj = $kelasService->ambilKelas($idKelas); $siswa->setNomorSiswa($nomorSiswa); $siswa->setNama($nama); $siswa->setKelas($kelasObj); $siswaService->ubahSiswa($siswa); } elseif ($perintah == "hapus") { $nomorSiswa = $_POST["nomorSiswa"]; $siswaService->hapusSiswa($nomorSiswa); }