-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete_students_inc.php
43 lines (29 loc) · 1.1 KB
/
delete_students_inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
ob_start();
include "connect.inc.php";
include "core.inc.php";
if (admin_logged_in()) {
?>
<form action="delete_students_inc.php" method="GET">
<input type="hidden" name="student_id_del"><br><br>
<input type="submit" value="Delete"> <a href="admin.php"><input type="button" value="Cancel"></a>
</form>
<?php
if (isset($_GET['student_id_del']) && !empty($_GET['student_id_del'])) {
$student_id_del = $_GET['student_id_del'];
$test_query = "SELECT `name` FROM `students` WHERE `Student_Id`='$student_id_del'";
$del_query = "DELETE FROM `students` WHERE `Student_Id`='$student_id_del'";
if (mysqli_num_rows(mysqli_query($con, $test_query)) > 0) {
if ($del_query_run = mysqli_query($con, $del_query)) {
header("Location: admin.php");
}
} else {
echo "There is no such student in the database";
}
} else {
echo "You must specify the student id for security purposes";
}
} else {
header("Location: admin.php");
}
?>