-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete.php
59 lines (53 loc) · 1.75 KB
/
delete.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
include_once 'classes/database.php';
include_once 'classes/user.php';
include_once 'initial.php';
// get database connection
$user = new User($db);
// check if the submit button yes was clicked
if (isset($_POST['del-btn']))
{
$id = $_GET['id'];
$user->delete($id);
header("Location: delete.php?deleted");
}
//set page headers
$page_title = "Delete User";
include_once "header.php";
echo "<h2>{$page_title}</h2>";
// check if the user was deleted
if(isset($_GET['deleted'])){
echo "<div class=\"alert alert-success alert-dismissable\">";
echo "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">
×
</button>";
echo "Success! User is deleted.";
echo "</div>";
}
?>
<!-- Bootstrap Form for deleting a user -->
<?php
if (isset($_GET['id'])) {
echo "<form method='post'>";
echo "<table class='table table-hover table-responsive table-bordered'>";
echo "<input type='hidden' name='id' value='id' />";
echo"<div class='alert alert-warning'>";
echo"Are you sure to delete?";
echo"</div>";
echo"<button type='submit' class='btn btn-danger' name='del-btn'>";
echo"Yes";
echo"</button>";
echo str_repeat(' ', 2);
echo"<a href='index.php' class='btn btn-light' role='button'>";
echo" No";
echo"</a>";
echo"</table>";
echo"</form>";
}
else { // Back to the first page
echo"<a href='index.php' class='btn btn-large btn-success'><i class=\"fa fa-arrow-circle-left\" aria-hidden=\"true\"></i></span> Home </a>";
}
?>
<?php
include_once "footer.php";
?>