-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequest.php
More file actions
145 lines (142 loc) · 4.38 KB
/
request.php
File metadata and controls
145 lines (142 loc) · 4.38 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Select Cities</title>
<!-- Google Fonts and Font Awesome -->
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
<style>
* {
box-sizing: border-box;
}
body {
margin: 0;
padding: 40px 20px;
font-family: 'Poppins', sans-serif;
background: linear-gradient(135deg, #1f1c2c, #928dab);
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.container {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(15px);
-webkit-backdrop-filter: blur(15px);
padding: 40px;
border-radius: 20px;
max-width: 750px;
width: 100%;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
color: #fff;
}
h2 {
text-align: center;
margin-bottom: 25px;
font-size: 26px;
font-weight: 600;
color: #ffffff;
text-shadow: 0px 2px 6px rgba(0,0,0,0.2);
}
.city-list {
max-height: 400px;
overflow-y: auto;
padding: 10px;
margin-bottom: 25px;
border-radius: 10px;
}
.city-list label {
display: flex;
align-items: center;
padding: 12px 15px;
margin-bottom: 10px;
border-radius: 10px;
background: rgba(255, 255, 255, 0.15);
backdrop-filter: blur(10px);
cursor: pointer;
transition: background 0.3s ease;
}
.city-list label:hover {
background: rgba(255, 255, 255, 0.25);
}
.city-list input[type="checkbox"] {
margin-right: 12px;
transform: scale(1.3);
cursor: pointer;
}
.city-list i {
margin-right: 10px;
color: #00ffff;
}
button {
display: block;
width: 100%;
padding: 14px;
background: linear-gradient(135deg, #ff416c, #ff4b2b);
color: white;
font-size: 16px;
font-weight: bold;
border: none;
border-radius: 30px;
cursor: pointer;
transition: all 0.3s ease;
}
button:hover {
transform: scale(1.05);
background: linear-gradient(135deg, #ff4b2b, #ff416c);
}
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-thumb {
background: rgba(255,255,255,0.2);
border-radius: 10px;
}
</style>
</head>
<?php
session_start();
if (!isset($_SESSION['user_email'])) {
header("Location: index.php");
exit();
}
// Connect to the correct database
$conn = new mysqli("localhost", "root", "", "aqilist");
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Fetch city data from 'aqi' table
$result = $conn->query("SELECT * FROM aqi LIMIT 20");
?>
<body>
<div class="container">
<h2>Please select at least 10 cities</h2>
<?php if ($result->num_rows > 0): ?>
<form action="showaqi.php" method="POST">
<div class="city-list">
<?php while ($row = $result->fetch_assoc()): ?>
<label>
<input type="checkbox" name="cities[]" value="<?= $row['ID'] ?>">
<?= $row['ID'] ?> .
<?= htmlspecialchars($row['CITY']) ?>, <?= htmlspecialchars($row['COUNTRY']) ?>
</label>
<?php endwhile; ?>
</div>
<button type="submit">Submit</button>
<script>
document.querySelector('form').addEventListener('submit', function(e) {
const checked = document.querySelectorAll('input[name="cities[]"]:checked');
if (checked.length < 10) {
alert("Please select at least 10 cities.");
e.preventDefault();
}
});
</script>
</form>
<?php else: ?>
<p>No cities found.</p>
<?php endif; ?>
</div>
</body>
</html>