Last active
December 18, 2015 03:28
-
-
Save voldern/5717948 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
if (!empty($_REQUEST['dogs']) && is_array($_REQUEST['dogs'])) { | |
$dogs = $_REQUEST['dogs']; | |
} else { | |
$dogs = null; | |
header('HTTP/1.0 400 Bad Request', true, 400); | |
} | |
?> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Dogs > cats</title> | |
</head> | |
<body> | |
<?php if ($dogs !== null): ?> | |
<ul> | |
<?php foreach ($dogs as $index => $dog): ?> | |
<li>Dog <?php echo $index + 1 ?>: <?php echo htmlentities($dog) ?></li> | |
<?php endforeach ?> | |
</ul> | |
<?php else: ?> | |
<strong>Who let the dogs out?</strong> | |
<?php endif ?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment