18041 sujets
Questions générales et questions de débutants
<?php
$reponses = array(
'chx' => array(
'reponse' => 'une  ',
'mot' => 'signature',
'image' => '../img/signature.jpg',
'btn' => '../btn/haut-parleur.png',
'mp3' => '../mp3/signature.mp3',
'alt' => 'image de signature'
) ,
'chx_1' => array(
'reponse' => 'une  ',
'mot' => 'montagne',
'image' => '../img/montagne.jpg',
'btn' => '../btn/haut-parleur.png',
'mp3' => '../mp3/montagne.mp3',
'alt' => 'image de montagne'
) ,
'chx_2' => array(
'reponse' => 'une  ',
'mot' => 'ligne',
'image' => '../img/ligne.jpg',
'btn' => '../btn/haut-parleur.png',
'mp3' => '../mp3/ligne.mp3',
'alt' => 'image de ligne'
) ,
'chx_3' => array(
'reponse' => 'une  ',
'mot' => 'baignoire',
'image' => '../img/baignoire.jpg',
'btn' => '../btn/haut-parleur.png',
'mp3' => '../mp3/baignoire.mp3',
'alt' => 'image de baignoire'
) ,
'chx_4' => array(
'reponse' => 'l\'  ',
'mot' => 'Espagne',
'image' => '../img/espagne.jpg',
'btn' => '../btn/haut-parleur.png',
'mp3' => '../mp3/espagne.mp3',
'alt' => 'image de l\'espagne'
) ,
'chx_5' => array(
'reponse' => 'du  ',
'mot' => 'champagne',
'image' => '../img/champagne.jpg',
'btn' => '../btn/haut-parleur.png',
'mp3' => '../mp3/champagne.mp3',
'alt' => 'image de verre de champagne'
) ,
'chx_6' => array(
'reponse' => 'un  ',
'mot' => 'champignon',
'image' => '../img/champignon.jpg',
'btn' => '../btn/haut-parleur.png',
'mp3' => '../mp3/champignon.mp3',
'alt' => 'image de champignon'
) ,
'chx_7' => array(
'reponse' => 'un  ',
'mot' => 'oignon',
'image' => '../img/oignon.jpg',
'btn' => '../btn/haut-parleur.png',
'mp3' => '../mp3/oignon.mp3',
'alt' => 'image d\'oignon'
)
);
$errors = array();
$point = array();
$i = 1.25;
$MSG = '';
foreach($reponses as $cle => $reponse)
{
if (isset($_POST['correction']))
{
$clic = $_POST[$cle];
$errorMSG = 0;
if (empty($clic) && empty($clic) && 0 == $errorMSG)
{
$MSG = '<p style="font-size:1.2em;margin:-2em 0 2em 20%;display:block;">vous n\'avez pas rempli tous les champs, veuillez recommençer !</p>';
$errorMSG = 0;
}else
if ($clic == $reponse['mot'])
{
$point[$cle] = htmlspecialchars($clic);
echo '<article class="content_img_2">';
echo'<figure><img src="' . $reponse['image'] . '" alt="' . $reponse['mot'] . '" width:"75" height="75" /></figure>';
echo'<p style="margin-top:8em;"><b>' . $reponse['reponse'] . ' ' . $reponse['mot'] . '</b></p>';
echo'</article>';
}
else
if ($clic !== $reponse['mot'])
{
$errors[$cle] = htmlspecialchars($clic);
echo '<article class="content_img_2">';
echo'<figure><img src="' . $reponse['image'] . '" alt="" width:"75" height="75" /></figure><br />';
echo'<p style="margin-top:7em;"><del><b>'.$reponse['reponse'].'' . $errors[$cle] . '</b></del></p><br /><p style="margin-top:.5em;color:red;"><b>' . $reponse['reponse'] .' '. $reponse['mot'] . '</b></p>';
echo'</article>';
}
}
}
echo'<div class="clear"></div>';
echo '<br /><br />';
?>
<p><?php echo $MSG; ?></p>
<p style="background:#99e3df;" class="total_reponse">Bonnes réponses : <?php echo count($point)*$i; ?>/10</p>