J'ai une 1ère page php : site0.php, sur laquelle j'ai un formulaire avec un checkbox et un bouton d'envoi :
Code : Tout sélectionner
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<link href="../css/cssevaluation4.css" rel="stylesheet" type="text/css" />
</head>
<form action="site1.php" method="post">
<input type=checkbox name="rep1[]" value="titi" />titi<br />
<input type=checkbox name="rep1[]" value="toto" />toto<br />
<input type=checkbox name="rep1[]" value="tata" />tata<br />
<input type=checkbox name="rep1[]" value="tutu" />tutu<br />
<input type="submit" name="validation" value="envoyer">
</form>
</html>Code : Tout sélectionner
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<link href="../css/cssevaluation4.css" rel="stylesheet" type="text/css" />
</head>
<table>
<caption>Voici les résultats</caption>
<thead> <!-- En-tête du tableau -->
<tr>
<th>Votre réponse</th>
<th>La bonne réponse</th>
<th>Corrigé</th>
</tr>
</thead>
<tr>
<td><?php if (isset($_POST['validation'])){foreach ($_POST['rep1'] as $choix){echo $choix,"<br>";}}?></td>
<td><?php echo 'titi,toto';?></td>
<td><?php if ( ??????? ) {echo '<span class="vrai"><strong>Vrai</strong></span>';} else{echo '<span class="faux"><strong>Faux</strong></span>';}?></td>
</tr>
</table>
</html>Dans la 2ème colonne, j'ai la réponse souhaitée
Et j'aimerais, dans la 3ème colonne, que ça soit écrit vrai, si les choix du checkbox correspondent à la réponse souhaitée et faux si ce n'est pas la bonne réponse.
Merci d'avance.