salut je cite mon problème.
j'ai une table qui contient tous mes clients et dans chaque ligne il y a un petit bouton modifier, apres le clique de ce dernier il y a un pop up formulaire jquery.
mon soucis comment récupérer les données de chaque client apres clique sur bouton modifier et les afficher dans mes input (popup formulaire)
j'ai pensé a ajax et xml mais y t il pas une autrecolution d'utiliser que ajax sans xml
extrait de mon code client.php
test.php
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136 <!----------fonction ajax-----------> <script type="text/javascript"> function ajax(page,var1) { var xhr=null; if(window.XMLHttpRequest) { xhr=new XMLHttpRequest; } if(window.ActiveXObject) { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } xhr.onreadystatechange= function() { if(xhr.readyState == 4 && xhr.status == 200) { alert(xhr.responseText); } } page = page + "?num="+ var1 ; xhr.open('GET',page,true); xhr.send(null) } <!-----------popup jquery----------------> <script type="text/javascript" charset="utf-8"> $(function() { function launch() { $('#sign_up').lightbox_me({centered: true, onLoad: function() { $('#sign_up').find('input:first').focus()}}); } $('.form').click(function(e) { //recuperation N°client var cle = e.target.id; // Fonction Ajax ajax("test.php", cle); $("#sign_up").lightbox_me({centered: true, onLoad: function() { $("#sign_up").find("input:first").focus(); }}); e.preventDefault(); }); $('table tr:nth-child(even)').addClass('stripe'); }); </script> <!-------- tableau --------------> <table class="display" id="dt3"> <thead> <tr> <th width="63">N°client</th> <th width="197">Nom prenom</th> <th width="157">Raison social</th> <th width="244">Email</th> <th width="177">mobile</th> <th width="81">Actif</th> <th width="83">Action</th> </tr> </thead> <tbody> <?php while($l=$req->fetch(PDO::FETCH_OBJ)){ echo ' <tr class="odd gradeX"> <td><span id="'.$l->num_clt.'">'.$l->num_clt.'</span></td> <td>'.$l->nom.' '. $l->prenom.'</td> <td>'.$l->rs.'</td> <td>'.$l->email.'</td> <td class="center"> '.$l->mobile.'</td> <td class="center"><img src="image/'.$etatActif[$l->actif].'.png"></td> <td class="center" align="center"> <table width="80" border="0" align="right" cellpadding="0" cellspacing="0"> <tr> <td><a href="#" title="Fiche détaillé du client"><img src="image/clients.jpg" width="16" height="16"></a></td> <td><a href="#" class="form" title="Modifier ce client"><img src="image/user_edit.png" id="'.$l->num_clt.'" width="16" height="16"></a></td> <td><a href="#" title="Supprimer ce client"><img src="image/user_delete.png" width="16" height="16"></a></td> </tr> </table> </td> </tr> '; } ?> </tbody> </table> <table class="display"> <tbody> </tbody> </table> <!----------popup--------------> <!---Modal show-!--> <div style="height: 2927px; position: absolute; width: 100%; top: 0px; left: 0px; right: 0px; bottom: 0px; z-index: 1001; background: none repeat scroll 0% 0% black; opacity: 0.3; display: none;" class="lb_overlay js_lb_overlay"></div><div style="display: none; left: 50%; margin-left: -223px; z-index: 1002; position: fixed; top: 50%; margin-top: -159px;" id="sign_up"> <span>Please sign in using the form below</span> <div id="sign_up_form"> <label><strong>N°client:</strong> <input type="number" id="num" name="num" value="" ></label> <label><strong>Nom:</strong> <input type="text" id="nom" name="nom" ></label> <label><strong>Prenom:</strong> <input type="text" id="prenom" name="prenom" ></label> <label><strong>Raison social:</strong> <input type="text" id="rs" name="rs" ></label> <label><strong>Fix:</strong> <input type="tel" id="fix" name="fix" ></label> <label><strong>Mobile:</strong> <input type="tel" id="fix" name="fix" ></label> <label><strong>Adresse:</strong> <input type="text" id="adr" name="adr" ></label> <label><strong>Ville:</strong> <input type="text" id="ville" name="ville" ></label> <label><strong>Email:</strong> <input type="email" id="mail" name="mail" ></label> <label><strong>Actif:</strong> <input type="text" id="actif" name="actif" ></label> <div id="actions"> <a class="close form_button sprited" id="cancel" href="#">Cancel</a> <input class="form_button" type="submit" value="Modifer" /> </div> </div> <h3 id="left_out" class="sprited">Feeling left out?</h3> <span>Don't be sad, just <a href="#">click here</a> to sign up!</span> <a id="close_x" class="close sprited" href="#">close</a> </div>
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 <?php require_once("class/config.inc.php"); if(isset($_GET['num'])){ $req=$db->prepare(" SELECT * FROM `clients` WHERE `num_clt`=".$_GET['num']." "); // on prépare notre requête $req->execute(); if($l=$req->fetch(PDO::FETCH_OBJ)){ echo $l->nom; echo $l->prenom; echo $l->adr; } } ?>
Partager