-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcountry.php
36 lines (32 loc) · 1.21 KB
/
country.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
<?php
require_once 'nav.php';
$input_country = $_POST["country"];
$_SESSION['usercountry'] = $input_country;
// if else boolean that checks if you're from denmark
function foreignCountry($input_country) {
if ($input_country == "Denmark") {
echo "Of course!";
}
else {
echo "A foreigner! Exciting!";
}
}
?>
<section class="content">
<!-- Displaying user country from agedivide.php -->
<h1><?php echo $_SESSION['usercountry'];?>?</h1>
<!-- Displaying text from boolean function -->
<h2><?php echo foreignCountry($input_country);?></h2>
<!-- Finds the select value and finds the corresponding name in img files to display -->
<img class="flag_img" src="img/flags/<?php echo $_SESSION['usercountry'];?>.svg">
<h3>What city do you live in?</h3>
<!-- Gets the city from input field (works in multiple languages, e.g. København & Copenhagen) -->
<form method="post" action="city.php" required autocomplete="off">
<input type="text" name="city">
<aside>* Valid cities only, please. Not case sensitive.</aside>
<br>
<button type="submit">Proceed</button>
</form>
</section>
</body>
</html>