Bonjour,
voila je realise un site pour mon ecole et la je dois creer une page pour les affectations des options. Donc sur ma page il y a un tableau avec une colonne pour le nom prenom (que je recupere de ma base de données) une collone pour le 1er voeux, une pour le 2eme et une pour le 3eme voeux (aussi recuperer de la base de données) puis une colonne pour realiser les affectations avec un :et un bouton submit afin d'affecter l'option pour chaque eleve (info que je dois ensuite ecrire dans ma base de données). et enfin une derniere colonne qui affiche le voeux affecter.
Code : Sélectionner tout - Visualiser dans une fenêtre à part <input type='texte' name='$nom'>
voila mon probleme quand je veux affecter une option a un eleve celle-ci s'affecte a tous les eleves.
Merci
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107 <!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" > <body> <h2>AFFECTATIONS 1A MRI</h2><br/> <center>Mobilité = Temps réel et Mobilité<br>Multimédia = Ingénierie du multimédia <br>Com. élec. = Commerce électronique<br><br></center> <table> <thead> <!-- En-tête du tableau --> <tr> <th>Nom</th> <th>Prénom</th> <th>Voeux 1</th> <th>Voeux 2</th> <th>Voeux 3</th> <th>Affecter<br>voeux n° :</th> <th>Voeux affecté</th> </tr> </thead> <tfoot> <!-- Pied de tableau --> <tr> <th>Nom</th> <th>Prénom</th> <th>Voeux 1</th> <th>Voeux 2</th> <th>Voeux 3</th> <th>Affectation</th> <th>Voeux affecté</th> </tr> </tfoot> <tbody> <!-- Corps du tableau --> <?php mysql_connect("localhost", "root", ""); mysql_select_db("choix_option"); $reponse=mysql_query("SELECT nom, prenom, voeux1, voeux2, voeux3 FROM voeux_eleves WHERE classe='1' ORDER BY nom"); while ($eleve = mysql_fetch_array($reponse)) { $nom=$eleve['nom']; if($eleve['voeux1']==1) $eleve['voeux1']= "Mobilité"; if($eleve['voeux1']==2) $eleve['voeux1']= "Multimédia"; if($eleve['voeux1']==3) $eleve['voeux1']= "Com. élec."; if($eleve['voeux2']==1) $eleve['voeux2']= "Mobilité"; if($eleve['voeux2']==2) $eleve['voeux2']= "Multimédia"; if($eleve['voeux2']==3) $eleve['voeux2']= "Com. élec."; if($eleve['voeux3']==1) $eleve['voeux3']= "Mobilité"; if($eleve['voeux3']==2) $eleve['voeux3']= "Multimédia"; if($eleve['voeux3']==3) $eleve['voeux3']= "Com. élec."; $donnees=mysql_query("SELECT affectation FROM affectation WHERE nom='$nom' AND classe='1'"); $affec = mysql_fetch_array($donnees); if($affec['affectation']==1) $affec['affectation']= "Mobilité"; if($affec['affectation']==2) $affec['affectation']= "Multimédia"; if($affec['affectation']==3) $affec['affectation']= "Com. élec."; echo "<tr>"; echo "<td>"; echo strtoupper($eleve['nom']); echo "</td>"; echo "<td>"; echo strtoupper($eleve['prenom']); echo "</td>"; echo "<td>"; echo $eleve['voeux1']; echo "</td>"; echo "<td>"; echo $eleve['voeux2']; echo "<td>"; echo $eleve['voeux3']; echo "</td>"; echo "<td>"; ?><form method="post" action="aspect_prof.php?page=affectation_1ASTI"><input type='texte' name='$nom' style='width:40px;height:20px;'><center><input type="submit" value="Valider" /></center></form><?php echo "</td>"; echo "<td>"; $affec=$_POST['$nom']; echo $affec; mysql_query("UPDATE affectation SET affectation='$affec' WHERE classe='1' AND nom='$nom'"); echo "</td>"; echo "</tr>"; } ?> </tbody> </table> <a href="aspect_prof.php?page=affectation"><h4>retour au choix de filière</h4></a> <?php mysql_close(); ?> </body> </html>
Partager