comment recuperer les valeur des checkbox cochées
Bonjour,
Débutant en JavaScript, je cherche à récupérer la valeur d'une case coché:
Mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| <html>
<head>
<script >
function afficher(madiv)
{
alert(+document.getElementById('selectvehi').value);
}
</script>
<?php
$odbc = odbc_connect( 'bd_saisi_vic' , 'root' , '') or die ("Impossible de se connecter a la BD") ;
$sql9="SELECT * FROM T_vehicule ";
$requete9 = odbc_do($odbc,$sql9) or die( odbc_error());
?>
</head>
<body>
<table width="656" border="0" align="center">
<tr>
<td colspan="4" valign="top">Type de vehicule a utiliser :<?php
while($tab = odbc_fetch_array($requete9))
{?>
</td>
</tr>
<tr>
<td width="225"> </td>
<td width="22" height="20" valign="top">
<input type="checkbox" name='selectvehi' id="'selectvehi[]'" onclick="afficher('madiv')" value="<?php echo $tab['idvehi']; ?>" /></td>
<td width="171" valign="top"><?php echo $tab['libelvehi']; ?></td>
<td width="210" valign="top"><div id="madiv" ><input type="text" value="<?php echo $tab['idvehi']; ?>"></div></td>
<?php
}
?>
</tr>
</table>
</body>
</html> |
Dans un formulaire PHP, je récupère mes données en fonction d’une table, et affiche une checkbox devant chaque champ, quand je clique sur une case, je récupère la valeur du 1er enregistrement, comment puis je récupérer les autres valeurs ?