<?php
# This program uses a magic 8-ball to answer a question by the user.
if (isset($_REQUEST["question"])) {
  $question = $_REQUEST["question"];
} else {
  die("Missing parameter 'question'");
}
# pick a random things for the 8-ball to say
$answer = array_rand(file("sayings.txt"));
?>

<!DOCTYPE html>
<html>
  <head>
    <title>Magic 8-Ball</title>
    <link href="8ball.css" type="text/css" rel="stylesheet" />
  </head>

  <body>
    <p>The answer to, "<?= $question) ?>", is:</p>
    <div id="eightball"> <?= $answer ?> </div>
  </body>
</html>
