Exercices élèves
This commit is contained in:
45
exercice1.php
Normal file
45
exercice1.php
Normal file
@ -0,0 +1,45 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Exercice 1</title>
|
||||
</head>
|
||||
|
||||
<?php
|
||||
$mois = [
|
||||
1 => "janvier",
|
||||
2 => "février",
|
||||
#SUITE DU TABLEAU A COMPLETER
|
||||
];
|
||||
|
||||
#Cette condition vérifie que le numéro saisi par l'utilisateur est bien présent dans le tableau
|
||||
if ( array_key_exists($_GET["numero"], $mois) == false ){
|
||||
|
||||
header('Location: index.php?error=ex1');
|
||||
}
|
||||
|
||||
#FONCTION A COMPLETER
|
||||
function afficherMois($mois) {
|
||||
// Cette fonction doit afficher la liste des 12 mois définis dans le tableau
|
||||
// $mois ci-dessus, au format :
|
||||
// <p>Le mois n° NumeroDuMois est le mois de NomDuMois.</p>
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<body>
|
||||
<!-- FAIRE AFFICHER LE MOIS CHOISI PAR L'UTILSATEUR -->
|
||||
<h1>Vous avez choisi le mois de ....... !</h1>
|
||||
|
||||
<h3>Pour rappel, les mois de l'année sont :</h3>
|
||||
|
||||
<!-- FAIRE AFFICHER LES MOIS CONTENUS DANS LE TABLEAU
|
||||
Utiliser la fonction afficherMois() définie ci-dessus !
|
||||
-->
|
||||
|
||||
<?php include("footer.php");?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
Reference in New Issue
Block a user