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 58 59 60 61 62 63 64 65 66 67 68
| <?
if($_POST["nom"])
{
$tableau=$_POST["groupe"];
foreach($tableau as $val)
{
echo $val; echo "<br><br>";
}
}
?>
<form name=formulaire action="" method="POST" >
<table>
<tr>
<td><b>Nom: </b></td>
<td><input type="text" name="nom" id='nom' class="inptu">
</tr>
<tr>
<td ><b>Groupe: </b></td>
<td>
<table>
<?
$rq=mysql_query("SELECT groupe FROM table");
while($execrq=mysql_fetch_array($rq))
{
?>
<tr>
<td>
<INPUT TYPE=CHECKBOX id='chkbx' name='groupe[]' value=<?=$execrq["groupe"];?> onClick="show_div('divpen_<?=$execrq["groupe"];?>');"> <?echo $execrq["groupe"]; ?>
</OPTION>
</td>
<td id="divpen_<?=$execrq["groupe"];?>" style="display:none;">droit :
<SELECT name="grp" id="grp" value=this.value >
<OPTION value='0'>0</OPTION>
<OPTION value='1'>1</OPTION>
<OPTION value='2'>2</OPTION>
</SELECT>
</td>
</tr>
<?}
?>
</table>
</td>
</tr>
</table>
<script type="text/javascript">
function show_div(x)
{
var el = document.getElementById(x);
if(el.style.display == "none")
{
el.style.display = "block"; alert('checked');
}
else
{
el.style.display = "none"; alert('unchecked');
}
}
</script>
</form> |
Partager