-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathopdracht1-4.php
60 lines (47 loc) · 1.63 KB
/
opdracht1-4.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
<!DOCTYPE HTML>
<html>
<head>
</head>
<title>Song Organizer</title>
<body>
<a href="opdracht1.php">Opdracht 1</a><br>
<a href="opdracht1-2.php">Opdracht 1.2</a><br>
<a href="opdracht1-3.php">Opdracht 1.3</a><br>
<a href="opdracht1-4.php">Opdracht 1.4</a><br>
<a href="opdracht1-5.php">Opdracht 1.5</a><br>
<a href="opdracht1-6.php">Opdracht 1.6</a><br>
<hr>
<h1>Zodiac</h1>
<p>Vul (in het engels) alle zodiac dingen in. Gescheiden door een komma<br>
</p>
<p>Try this:<br>
Aries, Taurus, Gemini, Cancer, Leo, Virgo, Libra, Scorpio, Sagittarius, Capricorn, Aquarius, Pisces</p>
<form action="opdracht1-4.php" method="post">
<textarea name="zodiacs" rows="4" cols="50"></textarea>
<p><input type="submit" name="submit" value="GO!!"/></p>
</form>
<?php
$zodiacCheck = array('Capricorn', 'Aquarius', 'Pisces', 'Aries', 'Taurus', 'Gemini', 'Cancer', 'Leo', 'Virgo', 'Libra', 'Scorpio', 'Sagittarius');
$zodiacCheck = array_map('strtolower', $zodiacCheck);
sort($zodiacCheck);
if (isset($_POST['submit']))
{
$zodiacArray = explode(", ",$_POST['zodiacs']);
$zodiacArray = array_map('strtolower', $zodiacArray);
sort($zodiacArray);
if ($zodiacArray == $zodiacCheck) {
echo "<ol>";
foreach ($zodiacArray as $zodiacSorted) {
$zodiacSorted = ucfirst($zodiacSorted);
echo "<li>$zodiacSorted</li>";
};
echo "</ol>";
}
else{
echo "Vul alle zodiac sings in, probeer dit: ";
echo "Aries, Taurus, Gemini, Cancer, Leo, Virgo, Libra, Scorpio, Sagittarius, Capricorn, Aquarius, Pisces";
}
}
?>
</body>
</html>