Récupération Valeur CheckBox
Posté : 11 oct. 2017, 11:45
Bonjour,
Je n'arrive pas à récupérer la valeur d'un checkbox
Le formulaire
Je n'arrive pas à récupérer la valeur d'un checkbox
Le formulaire
<h1>Liste des Photographies Exposées</h1> <br />
<form id="form_mailing_send" action="admin_list_result.php" method="post" onsubmit="verifierCases(this)">
<table align="center" >
<tr>
<?php
//on met les valeurs de la table
while ($result_exposition = mysqli_fetch_array($query_exposition))
{
?>
<td colspan="3"><input type="checkbox" name="selection[]" value=<? echo " $result_exposition[PhototId]"; ?> ><? echo " $result_exposition[PhotoId]"; ?></td>
<td><? echo " <img src=/Vignettes/{$result_exposition['PhotoNumber']}"; ?> ></td>
<td colspan="3"><? echo " $result_exposition[PhotoNumber]"; ?></td>
<td colspan="3"><? echo " $result_exposition[PhotoName]"; ?></td>
<td colspan="3"><? echo " $result_exposition[ArtistName]"; ?></td>
<td><? echo "<a href=admin_photos_view.php?photo={$result_exposition['PhotoId']}"; ?> >
<img src=../Librairie/icones/view.gif alt=View width=16 height=16 border=0></td>
<td><? echo "<a href=admin_photos_modif.php?photo={$result_exposition['PhotoId']}"; ?> >
<img src=../Librairie/icones/edit.gif alt=Edit width=16 height=16 border=0></td>
<td><? echo "<a href=admin_photos_delete.php?photo={$result_exposition['PhotoId']}"; ?> >
<img src=../Librairie/icones/delete.gif alt=Delete width=16 height=16 border=0></td>
</tr>
<?php
//fin du while
}
?>
<tr>
<td><input type="button" value="cocher" name="cocher" onclick="cocheTous('selection[]');" /></td>
<td><input type="button" value="decocher" name="decocher" onclick="decocheTous('selection[]');" /></td>
</tr>
<td><input type="submit" value="envoi" name="envoi"></td>
</tr>
</table>
</form>
La page de réception<?php
if(isset($_POST['envoi']))
{
$selection=$_POST["selection"];
foreach ($selection as $choix)
{
echo "Choix utilisateur : ",$choix,"<br>";
// Fin foreach
}
// Fin Isset envoi
}
?>
Merci d'avance