-
Notifications
You must be signed in to change notification settings - Fork 0
/
cntact_msg.php
134 lines (113 loc) · 3.77 KB
/
cntact_msg.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?php include("config2.php");
require("admiLoginCheck.php");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<link rel="stylesheet" href="DreamTourCss.css ">
<style>
body{
width:100%;
min-height:100vh;
background-image:linear-gradient(rgba(0,0,0,.3),rgba(0,0,0,.3)) ,url(travelimages/elephants1.jpeg);
background-repeat: no-repeat;
background-attachment:fixed;
background-size: cover;
display:flex;
justify-content:space-between;
}
.pkg_table{position:absolute;
left: 5%;
top: 100px;
width: 90%;
}
</Style>
<title>contact requests</title>
</head>
<body>
<div class="topnav">
<a class= "logout" href="adminLogin.php">Logout</a>
<a href="reserved_pkg.php">Pakage Reservations</a>
<a href="admin_packages.php">Manage Pakages</a>
<a href="cntact_msg.php">Messages</a>
<a href="home.php">User Home</a>
</div>
<?php
if($_SERVER["REQUEST_METHOD"] == "POST")
{
if(isset($_POST['btnDelete']))
{
try {
$conn=new PDO($db,$un,$password);
$conn->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
$query="Delete from `contact`
WHERE `ID`=?";
$st=$conn->prepare($query);
;
$st->bindValue(1,$_POST["btnDelete"],PDO::PARAM_INT);
$st->execute();
echo '<script> alert(" Message deleted Sucessfully");</script>';
} catch (PDOException $th) {
echo $th->getMessage();
}
}
}
?>
</aside>
</div>
<main>
<div class="pkg_table">
<p style="font-size: 2rem; font-weight: 600;">Contact requests</p>
<form method="post" enctype="multipart/form-data ">
<div class="search">
<input type="text" class="inputBig" placeholder="Enter Package Name to search" name="txtSearch">
<input type="submit" name="btnSearch" value="Search">
</div>
<?php
try {
$conn=new PDO($db,$un,$password);
$conn->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
$query="SELECT `ID`, `Name`, `Email`, `Message` FROM `contact`";
if(isset($_POST["btnSearch"]))
{$query= $query."where Name like'%".$_POST["txtSearch"]."%'";}
$result=$conn->query($query);
echo '<table class="table table-striped">';
echo'<tr> <th> ID </th> <th>Name</th> <th> Email</th> <th>Message</th><th> Delete</th></tr>';
$i=0;
foreach($result as $row)
{echo'<tr>';
echo '<td> <input type="hidden"
name="pId[]" value="'. $row[0].'">
'. $row[0].'</td>';
echo'<td><input type="hidden" name="pName[]" value="'. $row[1].'">'. $row[1].'</td>';
echo'<td><input type="hidden" name="pPeriod[]" value="'. $row[2].'">'. $row[2].'</td>';
echo'<td><input type="hidden" name="pDescrip[]" value="'. $row[3].'">'. $row[3].'</td>';
echo'<td><button name="btnDelete" type="submit" value="'. $row[0].'">Delete</button></td>';
echo'</tr>';
$i++;
}
echo'</table>';
} catch ( PDOException $th) {
echo $th->getMessage();
}
?>
</form>
</div>
</main>
<?php
if(isset($_POST["btnEdit"]))
{
$r=$_POST["btnEdit"];
}
elseif(isset($_POST["btnDelete"]))
{
$r=$_POST["btnDelete"];
}
?>
</body>
</html>