salut tout le monde,
comment on fait pour capter la valeur d'une checkbox qui boucle sur une table mysql, c'est à dire, à chaque fois j'ajoute ou je supprime une option dans ma base, l'option en question disparaisse de mon interface checkbox :
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 ..... <form method="GET" ACTION="ActionVerifyNewProfile" name="frm" onsubmit="return validate();"><br> <fieldset id="Resultat"><legend><b><font size="2" color="#606060">Nouveau Profile</font></b></legend> <table callspacing="5" cellpadding="6" bgcolor="white" colspan="7" rowspan="2" style="width: 102%; margin: auto; background-color: white padding-bottom : 15px;"> <tr> <td><font size="2"> Nom profile : </font> <input type="text" value="" name="nomProfile"></td> </tr> <tr> <td><font size="2"> Choisissez au moins une option : </font> </td> <br> </tr> <% rst = s.executeQuery("select * from option order by NOM_option" ); while (rst.next()) { %> <tr> <td><input type="checkbox" name="r1" ><%=rst.getString("nom_option") %></td> </tr> <% } %> </table> </fieldset> <td><input type="SUBMIT" VALUE="Verifier" name="verifierProf" style="color: cyan; background-color: #6683b1;"> <input type="reset" value="Effacer" name="effaceprof" style="color: cyan; background-color: #6683b1;"> <input type="submit" value="Annuler" name="annuleProf" style="color: cyan; background-color: #6683b1;"></TD> </form>
<td><input type="checkbox" name="r1" ><%=rst.getString("nom_option") %></td> étant donnée que ma table option contient plusieurs valeurs.
r1(c'est le nom de mon checkbox) change alors régulièrement la valeur, donc ma request.getparameter(r1) va retourner la dernière valeur, et moi je veux récupérer l'ensemble des valeurs sélectionnées.
je pense que on peux faire cela aussi avec listbox mais je ne sais pas non plus comment faire.
j'aimerai bien à prendre les deux méthodes.
merci pour votre aide
Partager