-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyour_request.php
112 lines (110 loc) · 2.34 KB
/
your_request.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
101
102
103
104
105
106
107
108
109
110
111
112
<?php
include("navbar.php");
$username = $_SESSION["username"];
$userTable = '';
if (isset($_SESSION["userType"]))
{
if ($_SESSION["userType"]!=$user)
{
echo "<script>window.location.href='index.php';</script>";
exit();
}
else
{
$GLOBALS['userTable'] = 'hospital_reg';
}
}
else
{
echo "<script>window.location.href='index.php';</script>";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style/user.css">
<style>
body
{
background-color: #E5DFDE;
}
</style>
</head>
<body>
<div class="container">
<div class="row mt-5">
<div class="col-md-12 pt-2 pb-2 text-center tbhead">
<span class="font-weight-bold">Your Requests</span>
</div>
</div>
<div class="row">
<div class="col-md-12">
<table class="table table-light" style="width:100%;">
<thead>
<tr>
<th>Blood Group</th>
<th>Hospital</th>
<th>Status</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
<?php
$count = 0;
$slt_req = "SELECT * FROM request WHERE email = '$username'";
if ($result = mysqli_query($conn,$slt_req))
{
$count=mysqli_num_rows($result);
while ($row = mysqli_fetch_array($result))
{
$res_id = $row["req_id"];
?>
<tr>
<td><?php echo $row["hosptl_name"]; ?></td>
<td><?php echo $row["blg_grp"]; ?></td>
<td><?php echo $row["status"]; ?></td>
<td>
<?php
echo "<a href='your_request.php?delete=$res_id'>";
?>
<i class="fas fa-trash-alt fa-2x text-danger"></i>
</a>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<?php
if ($count==0)
{
?>
<div class="text-center mt-5">
<span style="font-size: 20px;">You have no request</span>
</div>
<?php
}
?>
</div>
</div>
</div>
</body>
</html>
<?php
if (isset($_GET["delete"]))
{
$req_id = $_GET["delete"];
$dlt_req = "DELETE FROM request WHERE req_id = '$req_id'";
if (mysqli_query($conn,$dlt_req))
{
echo "<script>window.location.href='your_request.php';</script>";
}
else
{
echo $conn->error;
}
}
?>