Checkbox de même name et value
Bonjour
je voulais savoir si vous pouviez m aider :
jais des checkbox avec le même nom , je veux qui si on coche alors je reçois une valeur 1 et si non je reçois la valeur 0
je sais pas pourquoi mon script ne marche pas
le voici
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
<form action="" method="POST">
<input type="checkbox" name="send[]" value="0" onclick="this.value=(this.value==0)?1:0"> 0 <br>
<input type="checkbox" name="send[]" value="0" onclick="this.value=(this.value==0)?1:0"> 1 <br>
<input type="checkbox" name="send[]" value="0" onclick="this.value=(this.value==0)?1:0"> 2 <br>
<input type="checkbox" name="send[]" value="0" onclick="this.value=(this.value==0)?1:0"> 3 <br>
<input type="checkbox" name="send[]" value="0" onclick="this.value=(this.value==0)?1:0"> 4 <br>
<input type="submit" value="submit">
</form>
<?php
if(isset($_POST))
{
foreach($_POST['send'] as $test)
{
echo $test;
}
}
?> |
merci a vous