-
Notifications
You must be signed in to change notification settings - Fork 0
/
Opdracht1-4.php
36 lines (35 loc) · 1.05 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
<!DOCTYPE html>
<html>
<head>
<title>PHP</title>
</head>
<body>
<form action="Opdracht1-4.php" method="post">
<textarea name="zodiacs" rows="4" cols="50"></textarea>
<p><input type="submit" name="submit" value="Zodiacify"/></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 "Enter al zodiac signs plox";
}
}
?>
<p>TESTTEKST: Aquarius,Pisces,Libra,Scorpio,Sagittarius,Capricorn,Aries,Taurus,Gemini,Cancer,Leo,Virgo</p>
</body>
</html>