-
Notifications
You must be signed in to change notification settings - Fork 0
/
UserRequests.php
111 lines (85 loc) · 3.14 KB
/
UserRequests.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
<?php
include 'database_connect.php';
if (isset($_POST['OK'])) {
$id_request=$_POST['id_request'];
$query1="update request_appointement
set status='accept' where id=$id_request";
$run=mysqli_query($conn, $query1);
if ($run) {
echo "<script>alert('Request Accepted')</script>";
}
else{
echo "<script>alert('Request Declined')</script>";
}
}
if (isset($_POST['NO'])) {
$id_request=$_POST['id_request'];
$query="delete from request_appointement where id=$id_request";
$run=mysqli_query($conn,$query);
if ($run) {
echo "<script>alert('Request Deleted')</script>";
}
else{
echo "<script>alert('Request Is Not Deleted')</script>";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title> Happy Paws Clinic </title>
<link rel ="stylesheet" href="css//UserRequests_Style.css">
</head>
<body>
<?php include 'header.php'?>
<!-- The header of the page -->
<!-- Title -->
<h1 class="title">
Appointments Requests
</h1>
<!-- List of Requests -->
<div class="List">
<ul>
<?php
$user_id=$_SESSION['id'];
$sql_select_request= "SELECT request_appointement.id, request_appointement.pet,request_appointement.user_id,pets.image
FROM request_appointement
INNER JOIN pets ON request_appointement.pet = pets.name and request_appointement.user_id=pets.user_id
where request_appointement.status='waiting' and request_appointement.user_id='$user_id' ;";
$Result_request = mysqli_query($conn, $sql_select_request);
$count=1;
while ($row_request = mysqli_fetch_object($Result_request))
{
$name_pet=$row_request->pet;
$id_=$row_request->id;
$id_user=$row_request->user_id;
$iamge=$row_request->image;
echo '
<form action="#" method="POST">
<div >
<li id="liDog" style="background-size: 150px; margin-top: 60px;background-image: url(images//'.$iamge.');"> '.$count.'-Appointment Request
<div class="icon">
<a href="PetProfileRequest.php?id_user='.$id_user.'&pet='.$name_pet.'">
<img src="image/paw.png" class="icons" width="30" height="30" alt="view profile"></a>
<a href="RequestView.php?id_request='.$id_.'">
<img src="image/visit.png" class="icons" width="30" height="30" alt="view request"></a>
<a href="UpdateRequestForm.php?updaterequest='.$id_.'" style="text-decoration: none;">
<img src="image/settingicon.png" class="icons" width="30" height="30" alt="edit Request">
</a>
<a href="delete.php?delete_request='.$id_.'" >
<input type="hidden" name="id_request" value="'.$id_.'" hidden="hidden">
<img src="image/delete.jpg" class="icons" width="30" height="30" alt="delete request">
</a>
</div>
</li>
</div>
</form>
';
$count=$count+1;
}
?>
</ul>
</div>
</body>
</html>