j'ai un souci, je voudrai avoir deux choix: un choix 'un' et un choix 'une' avec dix questions, jusqu’à maintenant pas de message d'erreur, mais sur dix réponses voulu, je n'en ai qu'une, pourquoi?
<?php
$reponses = array(
'chx' => array('reponse' => 'une', 'mot' => 'route'),
'chx_1' => array('reponse' => 'un', 'mot' => 'four'),
'chx_2' => array('reponse' => 'un', 'mot' => 'bouton'),
'chx_3' => array('reponse' => 'un', 'mot' => 'jour'),
'chx_4' => array('reponse' => 'une', 'mot' => 'poubelle'),
'chx_5' => array('reponse' => 'un', 'mot' => 'nouveau'),
'chx_6' => array('reponse' => 'un', 'mot' => 'trou'),
'chx_7' => array('reponse' => 'une', 'mot' => 'nouvelle'),
'chx_8' => array('reponse' => 'un', 'mot' => 'tournevis'),
'chx_9' => array('reponse' => 'une', 'mot' => 'douche'),
);
foreach($reponses as $cle => $reponse){
$choix = array (
'un' =>'un','une'=>'une'
);
foreach($choix as $key => $value_choix){
echo '<p><input type="checkbox" name="'.$cle.'" value="'.$reponse['reponse'].'" />'.$key.'</p>';
}
echo'<p></p><p><b>'.$reponse['mot'].'</b></p><br />';
}
if(isset($_POST['correction'])){
//print_r($_POST['correction']);
$cle= $_POST[$cle];
if(empty($cle)){
$msg = '<p>veuillez remplir tous les champs</p>';
echo $msg;
}else if($cle <= $reponses){
echo $cle;
$cle++;
}
}
?>
merci