voici ce que j'ai essayé de faire :
Code : Tout sélectionner
for($i=0;$i<'nb';$i++){
$j = 1;
$Rq = "insert into appartenance values ('" . $t["$i"] . "','" . $t["case"] . "','" . $t["$j"] . "')";
$resultat = $cn->exec($Rq);
}
$j++;
et voici ce que contient le formulaire :
Code : Tout sélectionner
<form action="index.php?action=groupe1" method="POST" name="myForm" target="_blank">
<table>
<label>Selectionnez les <input type="number" name="nb" value="nb"/> premiers
<input type="button" value="Cocher les étudiants" onclick="Cocher(document.myForm.nb.value);"/>
<br/><br/>
<tr> <th>Code</th>
<?php $i=1; while ($row = $resultat -> fetch()) { ?>
<tr>
<td><a href='./index.php?action=detail&CodeEtudiant=<?php echo $row[0] ?>'>
<label><?php echo $row[0] ;?></label>
<input type="checkbox" value="<?php echo $row[0] ;?>" name="case[<?php echo $i; $i++; ?>]">
</a></td>
</tr>
<?php }?>
</table>
<input type="submit" value="affecter à un groupe" />