-
Notifications
You must be signed in to change notification settings - Fork 194
Expand file tree
/
Copy pathexample_results.php
More file actions
36 lines (22 loc) · 799 Bytes
/
example_results.php
File metadata and controls
36 lines (22 loc) · 799 Bytes
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
<?php
if(!empty($_POST['submit'])) {
echo "<html>\n<body style='width: 400px; margin: 2em auto; font-family: Arial;'>";
if(!empty($_POST['cities'])) {
echo "\n<p><strong>You selected the following cities:</strong></p>\n<ul>";
foreach($_POST['cities'] as $city) {
// exclude any items with chars we don't want, just in case someone is playing
if(!preg_match('/^[-A-Z0-9\., ]+$/iD', $city)) continue;
// print the city
echo "\n\t<li>" , htmlspecialchars($city) , "</li>";
}
echo "\n</ul>";
} else {
echo "\n<p>No items selected</p>";
}
echo "\n<p><a href='example1.html'>Try Again?</a></p>";
echo "\n</body>\n</html>";
} else {
// if someone arrived here not having started at example.html
// then show example.html instead
require("example1.html");
}