Bonjour,
je continu avec les problemes pour mon code.
Mon but est de mettre en place un formulaire de modification.
Apres avoir sélectionné la personne a modifié (via un menu déroulant), les information apparaissent dans un formulaire.
pour l'instant, tout ce passe bien, mais à partir du moment ou je veux valider une modification, j'ai le droit à un joli message d'erreur :
mon code le voila:<form action="../op/op.UsrMgr.php" method="post" enctype="multipart/form-data" name="form
Fatal error: Call to a member function on a non-object in /home/prome/public_html/mydms_dev/out/out.UsrMgr.php on line 116
et le code de ma fonction getSelectedUser():
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 <?if($action == "edituser"){ $us=getSelectedUser(); ?> <form action="../op/op.UsrMgr.php" method="post" enctype="multipart/form-data" name="form<?print $us->getID();?>" onsubmit="return checkForm('<?print $us->getID();?>');"> <input type="Hidden" name="userid" value="<?print $us->getID();?>"> <input type="Hidden" name="action" value="edituser"> <table border="0"> <tr> <td colspan="2"><hr size="1" width="100%" color="#000080" noshade></td> </tr> <tr> <td class="inputDescription" valign="top"><?printMLText("user_login");?>:</td> <td class="standardText"><input name="login" value="<?print $us->getLogin();?>"></td> </tr> <tr> <td class="inputDescription" valign="top"><?printMLText("password");?>:</td> <td><input type="Password" name="pwd"></td> </tr> <tr> <td class="inputDescription"><?printMLText("confirm_pwd");?>:</td> <td><input type="Password" name="pwdconf"></td> </tr> <tr> <td class="inputDescription" valign="top"><?printMLText("user_name");?>:</td> <td class="standardText"><input name="name" value="<?print $us->getFullName();?>"></td> </tr> <tr> <td class="inputDescription" valign="top"><?printMLText("email");?>:</td> <td class="standardText"><input name="email" value="<?print $us->getEmail();?>"></td> </tr> <tr> <td class="inputDescription" valign="top"><?printMLText("comment");?>:</td> <td class="standardText"><textarea name="comment" rows="4" cols="30"><?print $us->getComment();?></textarea></td> </tr> <tr> <td class="inputDescription" valign="top"><?printMLText("user_image");?>:</td> <td class="standardText"> <? if ($us->hasImage()) print "<img src=\"".$us->getImageURL()."\">"; else printMLText("no_user_image"); ?> </td> </tr> <tr> <td class="inputDescription" valign="top"><?printMLText("new_user_image");?>:</td> <td class="standardText"><input type="file" name="userfile" accept="image/jpeg"></td> </tr> <tr> <td colspan="2"><br><input type="Submit"></td> </tr> </table> </form> <hr size="1" width="80%" color="#000080" noshade> <a class="standardText" href="../op/op.UsrMgr.php?userid=<?print $us->getID();?>&action=removeuser"><img src="images/del.gif" width="15" height="15" border="0" align="absmiddle" alt=""> <?printMLText("rm_user");?></a> </td> </tr> </table>
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 function getSelectedUser() { GLOBAL $db; $full = $_POST["fullname"]; $queryStr = "SELECT * FROM tblUsers WHERE fullName = '".$full."'"; $resArr = $db->getResultArray($queryStr); if (is_bool($resArr) && $resArr == false) return false; else if (count($resArr) != 1) return false; $resArr = $resArr[0]; return new User($resArr["id"], $resArr["login"], $resArr["pwd"], $resArr["fullName"], $resArr["email"], $resArr["comment"], $resArr["isAdmin"]); }
Partager