Bonjour j ai un petit form a faire pour enregistrer les inscrits à une sortie ( pour une assos )
J ai commencer mon form mais apres plusieurs tests je ne sauve rien ou pas les bonnes infos ds la bdd.
j ai enlever mon code d enregistrement, a base de foreach il enregistrer toutes
Mon code est:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <html><body><?php @$action = $_GET['action']; if ($action=='enregistrer'){ //on enregistre //champ de la table Mysql //nom //inscription j1 //inscription j2 foreach ($inscription_j1 as $choix1){ foreach ($inscription_j2 as $choix2){ enregistrer_inscription($_POST['nom'],$choix1,$choix2); } } }else{ //le form echo '<form name="test" action="test_checkbox.php?action=enregistrer" method="POST" >'; echo '<table>'; echo '<tr><td>Nom</td><td>Inscription jour 1</td><td>Inscription jour 2</td></tr>'; echo '<tr>'; echo '<td width="200"><input type="text" name="nom" value="nicolas" /></td>'; echo '<td width="200"><input type="checkbox" name="inscription_j1[]" value="" /></td>'; echo '<td width="200"><input type="checkbox" name="inscription_j2[]" value="" /></td>'; echo '</tr>'; echo '<tr>'; echo '<td><input type="text" name="nom" value="stephane" /></td>'; echo '<td><input type="checkbox" name="inscription_j1[]" value="" /></td>'; echo '<td><input type="checkbox" name="inscription_j2[]" value="" /></td>'; echo '</tr>'; echo '<tr>'; echo '<td><input type="text" name="nom" value="julien" /></td>'; echo '<td><input type="checkbox" name="inscription_j1[]" value="" /></td>'; echo '<td><input type="checkbox" name="inscription_j2[]" value="" /></td>'; echo '</tr>'; echo '<tr>'; echo '<td><input type="text" name="nom" value="max" /></td>'; echo '<td><input type="checkbox" name="inscription_j1[]" value="" /></td>'; echo '<td><input type="checkbox" name="inscription_j2[]" value="" /></td>'; echo '</tr>'; echo '<tr>'; echo '<td><input type="text" name="nom" value="sophie" /></td>'; echo '<td><input type="checkbox" name="inscription_j1[]" value="" /></td>'; echo '<td><input type="checkbox" name="inscription_j2[]" value="" /></td>'; echo '</tr>'; echo '</table><input type="submit" value="OK" /></form>'; } ?></body></html>
Partager