par
musicjmb » 04 mai 2012, 22:19
Bonjour,
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>
J'ai une 2ème page php :
site1.php, sur laquelle j'ai un tableau :
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
1ère colonne, j'ai la réponse faite par l'utilisateur sur le checkbox sur la page site0.php
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.
Bonjour,
J'ai une 1ère page php : [b]site0.php[/b], sur laquelle j'ai un formulaire avec un [b]checkbox[/b] et un[b] bouton d'envoi[/b] :
[code]<!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]
J'ai une 2ème page php : [b]site1.php[/b], sur laquelle j'ai un tableau :
[code]<!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>[/code]
Dans la [b]1ère colonne[/b], j'ai la réponse faite par l'utilisateur sur le checkbox sur la page site0.php
Dans la [b]2ème colonne[/b], j'ai la réponse souhaitée
Et j'aimerais, dans la [b]3ème colonne[/b], que ça soit écrit [b]vrai[/b], si les choix du checkbox correspondent à la réponse souhaitée et [b]faux[/b] si ce n'est pas la bonne réponse.
Merci d'avance.