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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| echo "<script language='javascript'>
function attrib_value(inId)
{
//alert(inId);
if(document.getElementById(inId).value==0)
{
document.getElementById(inId).value=-1;
}
else
{
document.getElementById(inId).value=0;
}
//alert(document.getElementById(inId).value);
}
</script>";
echo"<form name='armoirecassee' method='POST' action='resultat.php'>
...........
...........
...........
while($z<$nbarmoire+1)
{
if($z<10)$zp="0".$z; else $zp=$z;
if($res_armCassee!=0)
{
$checked=" checked ";
}
else
{
$checked="";
}
echo"<tr bgcolor='WHITE'><td> ".$res_rangee." </td><td> ".$zp." </td>
<td align=center>
<input type='checkbox' onclick='attrib_value(\"option".$res_rangee.$zp."\");' $checked></input>
<input type='hidden' name='Options[]' id=\"option".$res_rangee.$zp."\" value=\"$res_armCassee\" /></td></tr>";
$z++;
}
}
echo"<tr><td></td><td></td><td align=center><input type='submit' value='Valider'/></td></tr>";
echo"</table></form></body></html>";
print_r ($Option[1]);
mysql_free_result($rst);
$cnn_mysql->m_die();
}
}
?>
Ensuite dans ma page result.php j'ai juste mis une ligne histoire de voir si je récupère bien la valeur de la case a cocher :
if (isset($_POST['Options'])) {
for ($i = 0, $c = count($_POST['Options']); $i < $c; $i++) {
echo "<br/><b>" .$_POST['Options'][$i]. "</b>";
}
} |
Partager