public function delete($num = -1337) { if ($num != -1337) { parent::delete($num); $redirect = add_query_arg(array('page' => 'edb-ues', 'edb-action' => 'index'), strtok($_SERVER['REQUEST_URI'], '?')); echo '<div class="alert alert-success">L\'UE a bien été supprimée. Vous allez être redirigé dans 2 secondes.</div>'; echo "<META HTTP-EQUIV=\"Refresh\" Content=\"2; URL={$redirect}\">"; exit; } else { die('[DELETE1337] Impossible de supprimer si il n\'y a pas de numéro passé en paramètre.'); } }
<?php include 'header.php'; require 'asset/class/main.php'; $crud = new Main(); if (isset($_GET['confirmdelete'])) { $nim = $_GET['confirmdelete']; if ($crud->delete($nim)) { $msg = 'Sukses.. Data berhasil dihapus..'; } else { $msg = 'Error.. Data gagal dihapus..'; } } ?> <ol class="breadcrumb"> <li> <a href="index.php">Home</a> </li> <li> <a href="input.php">Tambah Data</a> </li> </ol> <?php if (isset($_GET['delete'])) { ?> <div class="alert alert-danger"> Apakah anda yakin ingin menghapus mahasiswa dengan NIM <?php print $_GET['delete']; ?> ? <a class="btn btn-danger" href="<?php print '?confirmdelete=' . $_GET['delete'];