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
|
<html>
<body>
<?php
@$action = $_GET['action'];
if ($action=='enregistrer'){
//on enregistre
//champ de la table Mysql
//nom
//inscription j1
//inscription j2
$inscription_j1 = $_POST['inscription_j1'];
$inscription_j2 = $_POST['inscription_j2'];
$nom = $_POST['nom'];
foreach ($nom as $personne){
$choix1 = $choix2 = 0;
if (isset($inscription_j1[$personne][0]))
{
$choix1 = $inscription_j1[$personne][0];
}
if (isset($inscription_j2[$personne][0]))
{
$choix2 = $inscription_j2[$personne][0];
}
//echo $personne.'-'.$choix1.'-'.$choix2.'<br>';
enregistrer_inscription($personne,$choix1,$choix2);
}
}else{
?>
<form name="test" action="?action=enregistrer" method="POST" >
<table>
<tr><td>Nom</td><td>Inscription jour 1</td><td>Inscription jour 2</td></tr>
<tr>
<td width="200"><input type="text" name="nom[]" value="nicolas" /></td>
<td width="200"><input type="checkbox" name="inscription_j1[nicolas][]" value="1" /></td>
<td width="200"><input type="checkbox" name="inscription_j2[nicolas][]" value="1" /></td>
</tr>
<tr>
<td><input type="text" name="nom[]" value="stephane" /></td>
<td><input type="checkbox" name="inscription_j1[stephane][]" value="1" /></td>
<td><input type="checkbox" name="inscription_j2[stephane][]" value="1" /></td>
</tr>
<tr>
<td><input type="text" name="nom[]" value="julien" /></td>
<td><input type="checkbox" name="inscription_j1[julien][]" value="1" /></td>
<td><input type="checkbox" name="inscription_j2[julien][]" value="1" /></td>
</tr>
<tr>
<td><input type="text" name="nom[]" value="max" /></td>
<td><input type="checkbox" name="inscription_j1[max][]" value="1" /></td>
<td><input type="checkbox" name="inscription_j2[max][]" value="1" /></td>
</tr>
<tr>
<td><input type="text" name="nom[]" value="sophie" /></td>
<td><input type="checkbox" name="inscription_j1[sophie][]" value="1" /></td>
<td><input type="checkbox" name="inscription_j2[sophie][]" value="1" /></td>
</tr>
</table>
<input type="submit" value="OK" />
</form>
<?php
}
?>
</body>
</html> |
Partager