1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| <?php
$array = array('1'=>array('libelle'=>'je vois grace à ','img'=>null,
'choix'=>array
('mes yeux.'=>true,
'ma tete.'=>false,
'mon nez.'=>false)),
'2'=>array('libelle'=>'je sens grace à . ','img'=>Null,
'choix'=>array
('mon bras.'=>false,
'mon nez.'=>true,
'mon coude.'=>false)),
'3'=>array('libelle'=>'high kick dans la gueule grace à','img'=>Null,
'choix'=>array
('mon pied.'=>true,
'mon genoux.'=>false,
'mon orteil.'=>false)));
echo "<form action='test.php' method='post'>";
foreach($array as $num=>$question){
echo '<h3>'.'QUESTION '.$num.'</h3>'.$array[$num]['img'].'<br />'.' -'.$array[$num]['libelle'].' :<br />';
foreach($question['choix'] as $reponse=>$choix){
echo '<input type="checkbox" name="choice['.$num.'][]" value="'.$reponse.''.$choix.'">'.$reponse.'<br />';
}
echo '<p />';
}
echo'<input type="RESET" value="Effacer" />';
echo'<input type="SUBMIT" name="btn_valid" value="Valider" />';
echo'</form>';
if(isset($_POST['choice'])){
print_r ($_POST['choice']);
foreach ($array as $num => $question){
echo'<p />QUESTION '.$num.' - '.$array[$num]['libelle'].' : <br />';
echo '--->vous avez repondu : ';
// mon probleme est ici ************************************************
if ($_POST["choice"]){
echo "la reponse est juste";
}
else{
echo "la reponse est fausse";
}
//************************************************
}
}
?> |
Partager