Problème pour récupérer un identifiant
Bonjour,
j'ai un petit problème avec mon code PHP, et je ne vois pas comment le résoudre. Voila mon code:
Code:
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
|
<? if ($action != "edituser"){ ?>
<form action="../out/out.UsrMgr.php?action=edituser&id=$id" method="post" enctype="multipart/form-data" name="form0" onsubmit="return checkForm('0');">
<table>
<tr>
<td class="inputDescription"><?=getMLText("user_name")?>:</td>
<td>
<?
print "<select>";
$users = getSelectUsers();
foreach ($users as $currUsers)
{
print "<option value=\"$currUsers\"";
if ($currUsers == $settings->_users)
print " selected";
print ">$currUsers";
}
print "</select>";
?>
</td>
</tr>
<tr>
<td colspan="2"><br><input type="Submit"></td>
</tr>
<? }elseif($action == "edituser"){
GLOBAL $db;
$queryStr = "SELECT id FROM tblUsers WHERE fullName = " . $currUsers;
$resArr = $db->getResultArray($queryStr);
echo $queryStr;
?>
<form action="../op/op.UsrMgr.php" method="post" enctype="multipart/form-data" name="form1">
<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="$login"></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="$fullName"></td>
</tr>
<tr>
<td class="inputDescription" valign="top"><?printMLText("email");?>:</td>
<td class="standardText"><input name="email" value="$email"></td>
</tr>
<tr>
<td class="inputDescription" valign="top"><?printMLText("comment");?>:</td>
<td class="standardText"><textarea name="comment" rows="4" cols="30"><? $comment ?></textarea></td>
</tr>
<tr>
<td class="inputDescription" valign="top"><?printMLText("user_image");?>:</td>
<td class="standardText">
<?
if ($currUser->hasImage())
print "<img src=\"".$currUser->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 $currUser->getID();?>&action=removeuser"><img src="images/del.gif" width="15" height="15" border="0" align="absmiddle" alt=""> <?printMLText("rm_user");?></a>
</td>
</tr>
</table>
<? } ?>
<?
printEndBox();
printCenterEnd();
printHTMLFoot();
?> |
Un menu déroulant doit donc apparaitre contenant les "fullName" des personnes présentent dans la base de données. Le problème, c'est que je n'arrive pas a récupérer l'identifiant de la personne sélectionnée...
Après avoir choisi la personne et appuyer sur le bouton, un formulaire de modification (donc contenant les informations sur la personne sélectionnée) doit normalement apparaitre.
Ma fonction getSelectUsers() :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
function getSelectUsers()
{
GLOBAL $db;
$queryStr = "SELECT fullname FROM tblUsers ORDER BY login";
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && $resArr == false)
return false;
$users = array();
for ($i = 0; $i < count($resArr); $i++)
$users[$i] = $resArr[$i]["fullName"];
return $users;
} |
Un petit coup de main serait pas de refus.
Merci