-
Notifications
You must be signed in to change notification settings - Fork 12
/
delete.php
100 lines (92 loc) · 2.27 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
/*
Author : Mohamed Aimane Skhairi
Email : skhairimedaimane@gmail.com
Repo : https://github.com/medaimane/crud-php-pdo-bootstrap-mysql
*/
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="container">
<?php
if(isset($_GET['deleted']))
{
?>
<div class="alert alert-success">
suppression avec succés
</div>
<?php
}
else
{
?>
<div class="alert alert-danger">
sûre de faire la suppression
</div>
<?php
}
?>
</div>
<div class="container">
<?php
if(isset($_GET['delete_id']))
{
?>
<table class='table table-bordered'>
<tr>
<th>N°</th>
<th>Nome</th>
<th>Prénom</th>
<th>E - mail</th>
<th>Tél</th>
</tr>
<?php
$stmt = $DB_con->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> Oui</button>
<a href="index.php" class="btn btn-large btn-success"><i class="glyphicon glyphicon-backward"></i> Non</a>
</form>
<?php
}
else
{
?>
<a href="index.php" class="btn btn-large btn-success" style="float: right;><i class="glyphicon glyphicon-backward"></i> Returner vers l'index</a>
<?php
}
?>
</p>
</div>
<?php include_once 'footer.php'; ?>