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
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr"><head>
<!--<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<html>
<?php
// connexion à la base
$db =mysql_connect('xxxxx', 'xxxxxxx', 'xxxxx');
mysql_select_db('xxxxxxx',$db);
for($ii = 0; $ii<11; $ii++){
$boxchecked=current(mysql_fetch_array(mysql_query("SELECT boolDyn FROM maTableDyn WHERE id = ".$ii." LIMIT 1")));
if ($boxchecked== 1)
{
$chk[$ii] = 'checked';
}
else
{
$chk[$ii] = '';
}
$description[$ii] = current(mysql_fetch_array(mysql_query("SELECT descriptionDyn FROM maTableDyn WHERE id = ".$ii." LIMIT 1")));
$data[$ii] = current(mysql_fetch_array(mysql_query("SELECT dataDyn FROM maTableDyn WHERE id = ".$ii." LIMIT 1")));
}
if(isset($_POST['submit1']))
{
for($ii = 1; $ii<11; $ii++){
if (isset($_POST['chk'.$ii.''])) // Case chochée
{
$req=mysql_query("UPDATE maTableDyn SET boolDyn=1 WHERE id = ".$ii."") or die(mysql_error());
}
else
{
$req=mysql_query("UPDATE maTableDyn SET boolDyn=0 WHERE id = ".$ii."") or die(mysql_error());
}
}
}
?>
</head>
<body>
<form name ="form1" method ="post" action ="<?echo $_SERVER['PHP_SELF']?>">
<!--<form name ="form1" method ="post" action ="test2.php">-->
<input type='checkbox' name="chk1" <?php print $chk[1]; ?>> Label1</br>
<input type='checkbox' name="chk2" <?php print $chk[2]; ?>> Label2</br>
<input type='checkbox' name="chk3" <?php print $chk[3]; ?>> Label3</br>
<input type='checkbox' name="chk4" <?php print $chk[4]; ?>> Label4</br>
<input type='checkbox' name="chk5" <?php print $chk[5]; ?>> Label5</br>
<input type='checkbox' name="chk6" <?php print $chk[6]; ?>> Label6 : <strong><?php print $data[6]; ?></strong></br>
<input type='checkbox' name="chk7" <?php print $chk[7]; ?>> Label7: <strong><?php print $data[7]; ?></strong></br>
<input type='checkbox' name="chk8" <?php print $chk[8]; ?>> Label8: <strong><?php print $data[8]; ?></strong></br>
<input type='checkbox' name="chk9" <?php print $chk[9]; ?>> Label9: <strong><?php print $data[9]; ?></strong></br>
<input type='checkbox' name="chk10" <?php print $chk[10]; ?>> Label10: <strong><?php print $data[10]; ?></strong></br>
<input type = "submit" name = "submit1" value = "Envoyer">
</form>
</form>
</body>
</html>
<?php
mysql_close();
?> |
Partager