-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathList_Of_Pets.php
85 lines (64 loc) · 2.85 KB
/
List_Of_Pets.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
<?php
include 'database_connect.php';
session_start();
$user_id=$_SESSION['id'];
if (isset($_POST['delete'])) {
$pets_id=$_POST['id'];
$query="delete from pets where id=$pets_id";
$run=mysqli_query($conn,$query);
if ($run) {
echo "<script>alert('1 Pet Deleted')</script>";
}
else{
echo "<script>alert('No pets Deleted')</script>";
}
}
?>
<!DOCTYPE html>
<!--view list of users pets page-->
<html>
<head>
<meta charset="utf-8">
<title> Happy Paws Clinic </title>
<link rel="stylesheet" href="css//list-of-pets-P10.css">
</head>
<?php
include 'header.php';
?>
<body class="body_mypets" style=" background-image: url(image//design12.png);">
<!-- ******************************************** this code in the first lines **********************-->
<!-- ******************-->
<h1 class="span_my_pets" ><span >My Pets</span> </h1>
<div>
<ul>
<?php
// <button type = "submit" name="delete"><input type="hidden" name="id" value="'.$row_pets->id.'" hidden="hidden"></button>
$sql_pets = "select * from pets where user_id=$user_id";
$Result_pets = mysqli_query($conn, $sql_pets);
if (mysqli_num_rows($Result_pets)>0) {
while ($row_pets = mysqli_fetch_object($Result_pets))
{
// <img src ="images//'.$row_pets->image.'" class = "icons" width="100" height="100" alt="manage pet profile" >
echo ' <form action="#" method="POST"> <div>
<li class="li_my_pets"> '.$row_pets->name.'
<a href="PetProfile.php?id_pets='.$row_pets->id.'">
<img src ="image//settingicon.png" class = "icons" width="20" height="20" alt="manage pet profile" >
</a>
<a href="delete.php?id_pets='.$row_pets->id.'">
<img src ="image//delete.jpg" class = "icons" width="20" height="20" alt="manage pet profile" >
</a>
</li>
</div></form>';
}
}
else
{ echo '<div>
<li class="li_my_pets"> No pets Added Yet..
</li>
</div>';
}
?>
</ul>
</div>
</body>
</html>