-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquery.php
More file actions
188 lines (82 loc) · 3.93 KB
/
Copy pathquery.php
File metadata and controls
188 lines (82 loc) · 3.93 KB
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<?php
require_once 'QueryHandler.php';
$handler = new QueryHandler();
$totalQueryCount = $handler->getTotalQueryCount();
$statusMessage = "";
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$name = htmlspecialchars($_POST['name']);
$email = htmlspecialchars($_POST['email']);
$phone = htmlspecialchars($_POST['phone']);
$message = htmlspecialchars($_POST['message']);
if ($handler->saveQuery($name, $email, $phone, $message)) {
$statusMessage = "<p class='text-green-700 text-center'>Thank you, $name! Your query has been saved we will back in 24 Hour.</p>";
$totalQueryCount = $handler->getTotalQueryCount(); // Update count
} else {
$statusMessage = "<p class='text-red-700 text-center'>Sorry, something went wrong. Please try again.</p>";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Query Page</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-gray-100 font-sans">
<div class="min-h-screen flex flex-col items-center justify-center relative">
<!-- Back Arrow at Top Left -->
<button onclick="window.history.back()" class="absolute top-4 left-4 bg-white">
← <!-- Left Arrow Symbol -->
</button>
<div class="bg-white shadow-lg rounded-lg p-8 w-full max-w-2xl">
<div class="mb-6 text-center">
<h1 class="text-2xl font-bold text-indigo-600">Welcome to the Query Page</h1>
</div>
<?php if ($statusMessage): ?>
<div class="mb-6 text-center"><?= $statusMessage ?></div>
<?php endif; ?>
<form id="queryForm" action="" method="POST" class="space-y-4">
<div>
<label for="name" class="block text-gray-700 font-semibold">Your Name</label>
<input type="text" id="name" name="name" required
class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-indigo-500">
</div>
<div>
<label for="email" class="block text-gray-700 font-semibold">Your Email</label>
<input type="email" id="email" name="email" required
class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-indigo-500">
</div>
<div>
<label for="phone" class="block text-gray-700 font-semibold">Phone Number</label>
<input type="tel" id="phone" name="phone" required
class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-indigo-500">
</div>
<div>
<label for="message" class="block text-gray-700 font-semibold">Your Message</label>
<textarea id="message" name="message" rows="4" required
class="w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-indigo-500"></textarea>
</div>
<div class="text-center">
<button type="submit"
class="bg-indigo-600 text-white px-6 py-2 rounded-full hover:bg-indigo-700">
Submit Query
</button>
</div>
</form>
</div>
<!-- Total Queries Raised -->
<p class="fixed bottom-4 right-4 bg-indigo-600 text-white px-6 py-3 rounded-full shadow-lg text-sm sm:text-base">
Total Queries Raised:
<span class="font-bold"><?= $totalQueryCount ?></span>
</p>
</div>
<script>
<?php if (isset($resetForm) && $resetForm === "true"): ?>
// Clear the form fields
document.getElementById("queryForm").reset();
<?php endif; ?>
</script>
</body>
</html>