-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdelete.php
More file actions
80 lines (80 loc) · 2.1 KB
/
delete.php
File metadata and controls
80 lines (80 loc) · 2.1 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
include_once 'dbconfig.php';
if(isset($_POST['btn-del'])) {
$id = $_GET['delete_id'];
$crud->delete($id);
header("location: delete.php?deleted");
}
?>
<?php include_once 'header.php'; ?>
<div class="clearfix"></div>
<div class="container">
<?php
if(isset($_GET['deleted'])) {
?>
<div class="alert alert-success">
<strong>Success!</strong> Record was successully deleted!
</div>
<?php
} else {
?>
<div class="alert alert-danger">
<strong>Sure !</strong> to remove the following record ?
</div>
<?php
}
?>
</div>
<div class="clearfix"></div>
<div class="container">
<?php
if(isset($_GET['delete_id'])) {
?>
<table class="table table-bordered">
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>E-Mail</th>
<th>Gender</th>
</tr>
<?php
$stmt = $dbc->prepare("SELECT * FROM tbl_users WHERE id=:id");
$stmt->execute(array(":id"=>$_GET['delete_id']));
while($row=$stmt->fetch(PDO::FETCH_BOTH)) {
?>
<tr>
<td><?php print($row['id']); ?></td>
<td><?php print($row['first_name']); ?></td>
<td><?php print($row['last_name']); ?></td>
<td><?php print($row['email_id']); ?></td>
<td><?php print($row['contact_no']); ?></td>
</tr>
<?php
}
?>
</table>
<?php
}
?>
</div>
<div class="container">
<p>
<?php
if(isset($_GET['delete_id'])) {
?>
<form method="post">
<input type="hidden" name="id" value="<?php echo $row['id']; ?>" />
<button class="btn btn-large btn-primary" type="submit" name="btn-del"><i class="glyphicon glyphicon-trash"></i> YES</button>
<a href="index.php" class="btn btn-large btn-success"><i class="glyphicon glyphicon-backward"></i> NO</a>
</form>
<?php
} else {
?>
<a href="index.php" class="btn btn-large btn-success"><i class="glyphicon glyphicon-backward"></i> Back to index</a>
<?php
}
?>
</p>
</div>
<?php include_once 'footer.php'; ?>