<?php
session_start();
$question = $_POST["question"];
$choices = file("reponses.txt"); // on charge les reponse dans un tableau
$answer = $choices[rand(0, count($choices) - 1)]; // choisir une reponse au hazard
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Question-Réponse</title>
</head>
<body>
<p>La réponse à la question,
<em>
<?php echo $question ?>
</em>, est</p>
<div> <?php echo $answer ?> </div>
</body>
</html>