-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser_info.php
82 lines (71 loc) · 2.28 KB
/
user_info.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
<?php
include('dbconnection.php');
$query = "SELECT * FROM users ORDER BY id ASC";
$run_query = mysqli_query($connection, $query);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<style>
input[type=submit]
{
background-color: #4CAF50; color: white; padding: 6px 10px; border: none; border-radius: 4px; cursor: pointer; float: inherit;
}
input[type=submit]:hover, input[type=file]:hover
{ background-color: #45a049; }
</style>
</head>
<body>
<div class="container">
<h2>USERS</h2><br>
<table class="table table-bordered table table-hover">
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>Phone</th>
<th>Address</th>
<th>Remove</th>
</tr>
</thead>
<tbody>
<?php
while( $result = mysqli_fetch_assoc($run_query) )
{
if($result)
for($i=0; $i<count($result); $i++)
?>
<tr>
<td><?php echo $result['full_name'] ?></td>
<td><?php echo $result['email'] ?></td>
<td><?php echo $result['phone'] ?></td>
<td><?php echo $result['address'] ?></td>
<td>
<form method="POST" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>">
<input value="<?php echo $result['email'] ?>" type="hidden" name="email">
<input value="remove" type="submit" name="">
</form>
</td>
</tr> <?php } ?>
</tbody>
</table>
</div>
</body>
</html>
<?php
$email="";
if($_SERVER["REQUEST_METHOD"]=="POST")
{
$email = $_POST['email'];
$query = "DELETE FROM users WHERE email='".$email."'" ;
$run_query = mysqli_query($connection, $query);
header("Location: #");
}
mysqli_close($connection);
?>