Bonjour! je m'en remets aux pros qui parcours ce forum pour essayer de comprendre mon problème.
Le voici, j'ai donc un script java qui me permet d'afficher des checkbox différentes suivant le bouton radio coché, le soucis c'est que je n'arrive pas à récupérer l'id de la valeur qui se trouve dans chaque checkbox, le but étant à terme de supprimer les données correspondantes aux checkbox séléctionnées, voici mon code !
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 //balise html blabla <style type="text/css">#D1, #D2, #D3, #D4, #D5, #D6 {display: none;}</style> <script type="text/javascript"> function showRadio() { var n = document.form.btnr.length; for(i=1;i<=n;i++) { if(document.getElementById('choix'+i).checked == true) { document.getElementById('D'+i).style.display = "block"; } else { document.getElementById('D'+i).style.display = "none"; } } } function changeImage(a) { document.getElementById("img").src=a; } </script> <body> <h2>Supprimer des photos</h2> <form name="form" action="Gestion/includes/maj.inc.php" method="post"> <label for="choix1">Sites web </label><input type="radio" id="choix1" name="btnr" value="pro" onclick="showRadio()" /> </br> <label for="choix2">Applications </label><input type="radio" id="choix2" name="btnr" value="ama" onclick="showRadio()" /><br /> <label for="choix3">Projets </label><input type="radio" id="choix3" name="btnr" value="ani" onclick="showRadio()" /> <br /> <label for="choix4">Paysages </label><input type="radio" id="choix4" name="btnr" value="asso" onclick="showRadio()" /><br /> <label for="choix5">Divertissements </label><input type="radio" id="choix5" name="btnr" value="div"onclick="showRadio()" /><br /> </p> <div id="D1"> <h2>Miniatures :</h2> <div style="width:450px; height:100px; overflow-y:scroll"> <?php $sqlSelectImg="SELECT * FROM majrealisation WHERE categorie='sites web'"; $reqSelectImg=mysql_query($sqlSelectImg); while($resSelectImg=mysql_fetch_array($reqSelectImg)) { $aSelectImg=$resSelectImg[1]; $aidImg=$resSelectImg[0]; ?> <label><?php echo $aSelectImg; ?><input type="checkbox" name="<?php echo $aidImg;?>" onclick='changeImage("images/realisations/<?php echo $aSelectImg; ?>");'> </label> <?php }?> </div> <h2>Photos:</h2> <div style="width:450px; height:100px; overflow-y:scroll"> <?php $sqlSelectImgG="SELECT * FROM majrealisation WHERE categorie='sites web'"; $reqSelectImgG=mysql_query($sqlSelectImgG); while($resSelectImgG=mysql_fetch_array($reqSelectImgG)) { $aSelectImgG=$resSelectImgG[2]; $aidImg=$resSelectImg[0]; ?> <label><?php echo $aidImg,$aSelectImgG;?> <input type="checkbox" name="<?php echo $aidImg;?>" " value="<?php echo $aidImg;?>" " > </label></br> <?php }?> </p> </div>quand j'affiche ma requête sqlsupp la variable $aidImg de mon WHERE est vide ...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 //le script pour delete if (isset($_POST['supprImg'])) { $sqlSuppr="DELETE FROM majpresentation WHERE idimage='".aidImg."'"; mysql_querry($sqlSuppr); } }
et je n'arrive pas à la récupérer
PS: le onClick sert à avoir un aperçu de l'image sélectionnée.
Partager