Bonjour a tous!
J'ai un petit pb avec un bout de code assez simple au final mais je n'arrive plus a y voir clair, je suis a la bourre, bref c'est la memerde...
Je m'explique, je dois faire un tableau qui renvoi des valeurs d'une table amelioration et je dois pouvoir donner la possibilité a l'utilisateur de mettre une note de 1 a 5 a cette proposition d'amelioration. Je fais donc un formulaire qui va lire dans la base de donnees la note correspondant a l'amelioration et je lui demande de me l'afficher. Toutes mes lignes de proposition d'amelioration s'affichent bien mais seule la derniere proposition d'amelioration a un input radio qui est lu et qui s'affiche. Toutes les premieres lignes affichent des input radio non coché. Ca doit venir d'une mauvaise utilisation de mes while, mais etant debutant et ayant passé quelques (10n) heures sur mon questionnaire je n'y vois plus rien!
Voici mon code :
J'etais sencé avoir fini ce travail avant-hier donc je suis un peu en panique...
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 <form method="post" action="ameliorationnote.php"> <table width="635" border=1> <tr valign="top"> <td colspan="6"> Si oui, quelles sont les priorités sur lesquelles les améliorations doivent se porter (notez de 1 à 5 en fonction de limportance accordée à la priorité,5 représentant une forte priorité) : </td> </tr> <tr valign="top"> <td>   </td> <td colspan="5"> image fleche </td> </tr> <tr valign="top"> <td>   </td> <td> 1 </td> <td> 2 </td> <td> 3 </td> <td> 4 </td> <td> 5 </td> </tr> <?php // OUVRIR CONNECTION require("connecter.php"); //requete sql dans la table en question $sql = 'SELECT ID_amelioration, Nom_amelioration FROM amelioration'; //affectation de la requete une variable $resultat = mysql_query($sql); //retourne le resultat dans un tableau while ($array = mysql_fetch_array($resultat)) { $sql3 = 'SELECT Note_ID FROM amelioration_epci WHERE Epci_ID="'.$_SESSION['ID_epci'].'" AND Amelioration_ID="'.$array['ID_amelioration'].'"'; $resultat3 = mysql_query($sql3); //retourne le resultat dans un tableau while ($array3 = mysql_fetch_array($resultat3)) { echo '<tr> <td> '.$array['Nom_amelioration'].' </td>'; echo '<td>'; if($array3['Note_ID'] == "NOTE1") { echo ' <input type="radio" name="note" id="1" value="1" checked="true" onclick="this.form.submit()">'; } else { echo ' <input type="radio" name="note" id="1" value="1" onclick="this.form.submit()">'; } echo ' </td> <td>'; if($array3['Note_ID'] == "NOTE2") { echo ' <input type="radio" name="note" id="2" value="2" checked="true" onclick="this.form.submit()">'; } else { echo ' <input type="radio" name="note" id="2" value="2" onclick="this.form.submit()">'; } echo ' </td> <td>'; if($array3['Note_ID'] == "NOTE3") { echo ' <input type="radio" name="note" id="3" value="3" checked="true" onclick="this.form.submit()">'; } else { echo ' <input type="radio" name="note" id="3" value="3" onclick="this.form.submit()">'; } echo ' </td> <td>'; if($array3['Note_ID'] == "NOTE4") { echo ' <input type="radio" name="note" id="4" value="4" checked="true" onclick="this.form.submit()">'; } else { echo ' <input type="radio" name="note" id="4" value="4" onclick="this.form.submit()">'; } echo ' </td> <td>'; if($array3['Note_ID'] == "NOTE5") { echo ' <input type="radio" name="note" id="5" value="5" checked="true" onclick="this.form.submit()">'; } else { echo ' <input type="radio" name="note" id="5" value="5" onclick="this.form.submit()">'; } echo ' </td>'; echo '</tr>'; } } ?>
Merci d'avance pour le coup de main!
Partager