Bonjour,
ma question est toute simple :
j'ai une page php qui contient 2 frames (appelées groupe et user).
Dans la frame groupe il y a un tableau (<tr><td></td></tr>).
Dans la frame user il y a un formulaire avec des checkbox.
J'aimerais au moment du clik sur une ligne du tableau de la frame groupe actualiser le formulaire de la frame user en " checkant " des lignes (au moins 1 mais au max indefini).
J'ai réussi à envoyer une valeur mais impossible d'en passer X
Je vous met des bouts de codes de ce que j'ai réussi pour vous donner une idée.
Dans la frame groupe :
Et dans la frame user :
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 $sql1 = "select distinct users.IDU,users.nom from users,lgroupe where users.IDU=lgroupe.IDU and lgroupe.IDG=".$reponse['IDG']." order by nom"; $p1 = mysql_query($sql1); while ($reponse1 = mysql_fetch_array($p1)) { $tablus[$nb_grp] = $reponse1['IDU']; } $color = "#ffffea"; $style1 = "style='border-top:$noir double 1px;border-bottom:$noir double 1px;border-left:$noir double 1px;'"; $style2 = "style='border-top:$noir double 1px;border-bottom:$noir double 1px;border-right:$noir double 1px;'"; $tableau = "<table id='table_g' cellpadding='0' cellspacing='0' width='100%'>"; for ($l=0; $l<$nb_grp; $l++){ $tableau .= "<tr bgcolor='$color' style='cursor:default;'"; $tableau .= " onclick='return false;' ondblclick='return false;'"; $tableau .= " onmouseover=\"this.style.background='$orange_clair';\""; $tableau .= " onmouseout=\"this.style.background='$color';\"'"; $tableau .= ">"; $tableau .= "<td valign='bottom' $style1 onclick='chek_user($taid[$l])'>"; $tableau .= "<font face='arial' size='3' color='$noir'>"; $tableau .= "<b>" .$tabl[$l]."</b></font>"; $tableau .= "</td>"; $tableau .= "<td valign='rigth' $style2>"; $tableau .= " <a href='../config/iframe_user.php?LocUser=0' onclick='popup_modif_group(1,1);'><img src='../img/admin/modif.png' border='0' width='18' height='16'></a> <a href='../config/iframe_user.php?LocUser=3'><img src='../img/admin/drop.png' border='0' width='18' height='16'></a>"; $tableau .= "</td>"; $tableau .= "</tr>"; $tableau .= "<tr><td> </td></tr>"; } $tableau .= "</table>"; ?> <html> <head> <script> function chek_user(group){ <? $champ = $tablus[0];?> var champ = "<? echo $champ; ?>"; parent.frames[1].location.href = "../config/iframe_user.php?LocUser=1&user="+champ+"&group="+group; } </script>
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 // Renvoie vrai si $option fait partie du résultat function est_selectionne($option) { if (!isset($_POST['mon_champ'])) { return FALSE; } for ($j = 0, $d = count($_POST['mon_champ']); $j < $d; $j++) { if ($_POST['mon_champ'][$j] == $option) { return TRUE; } } return FALSE; } ?> <? if (($LocUser == 0) or ($LocUser == 1)) // cas par defaut, point de depart { $mysql = new mysql(); $sql = "select * from users order by nom"; $u = mysql_query($sql); $nb_user = 0; while ($user = mysql_fetch_array($u)) { $tabl[$nb_user] = $user['nom']; $taid[$nb_user] = $user['IDU']; $nb_user++; } $sql = "select * from lgroupe where IDG = $idGroupe"; $lgu = mysql_query($sql); $lgroupe = mysql_fetch_array($lgu); if ($LocUser == 1){ $_POST['mon_champ'] = $users; est_selectionne($users); } } <html> <head> <script> function popup_nouv_user(){ page = "../config/onglet_general.php?"; mgest_popup(page,800,300,"no");} function popup_modif_user(user,group){ page = "../config/popup_redirect.php?user="+user+"&group="+group; //page = "../config/onglet_habilit.php?user="+user+"&group="+group; mgest_popup(page,800,300,"no");} </script> <body> <form name='formUser' action='' method='post' > <? for ($l=0; $l<$nb_user; $l++) { ?> <input type="checkbox" name="mon_champ[]" value=<? echo $taid[$l] ?> <?php if(est_selectionne("$taid[$l]")) { echo 'checked'; } ?>/><? echo $tabl[$l]; ?> <a href='../config/iframe_user.php?LocUser=0' onclick='popup_modif_user(<? echo $taid[$l]; ?>,"1");'><img src='../img/admin/modif.png' border='0' width='18' height='16'></a> <a href='../config/iframe_user.php?LocUser=3'><img src='../img/admin/drop.png' border='0' width='18' height='16'></a><br/> <? } ?> </form>
Partager