[PHP-JS] LDAP - Récupérer l'@email de l'emprunteur
J'ai construis une formulaire permettant de renseigner le pret d'un nom de machine, le modèle, le nom de l'emprunteur (liste déroulante récupération de l'annuaire LDAP), l'@ email, un n° d'intervention ...
En fait ce que je voudrais se situe au niveau du nom de l'emprunteur et de l'@email ... Je récupère correctement les noms de personnes via le LDAP dans une liste déroulante ... Ce que je voudrais c'est que ca renseigne ou récupere dés validation du formulaire, l'@email du nom sélectionné dans la liste déroulante ... Voyez vous ? ...
Comment feriez vous ?
Voici une partie de 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
|
...
<form name="emprunt_pp" action="?numlien=pre_valid" method="POST" onsubmit="return validation();">
<input type="hidden" name="id" value="<?php echo($id) ;?>">
<table border="0" align="center" cellspacing="2" cellpadding="2">
<tr align="left" border="1">
<td><font face="arial" size="2">Nom du Spare</font></td>
<td><INPUT TYPE="text" name="z_nomspare" onfocus = "document.forms.emprunt_pp.z_nomspare.blur()" value="<?php echo($result->nom_spare);?>"></td>
</tr>
<tr align="left">
<td><font face="arial" size="2">Modele du Portable</font></td>
<td><INPUT TYPE="text" name="z_modele" onfocus = "document.forms.emprunt_pp.z_modele.blur()" value="<?php echo($result->modele);?>"></td>
</tr>
<tr align="left">
<td><strong><font face="arial" size="2">Nom de l'emprunteur</font></strong></td>
<td><SELECT name="z_emprunteur"><?php
$ldaprdn = 'admaltiris'; // user
$ldappass = 'silicone'; // password
// connect to ldap server
$ldapconn = ldap_connect("as-dc01") or die("Could not connect to LDAP server.");
ldap_set_option($ldapconn, LDAP_OPT_SIZELIMIT, 5000);
if ($ldapconn) {
// binding to ldap server
@$ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
$dn = "ou=AS-Users, dc=as, dc=asd, dc=asf";
$filter="cn=*";
$justthese= array("cn","mail");
$sr=ldap_search($ldapconn, $dn, $filter, $justthese);
ldap_sort($ldapconn,$sr,"cn");
$info = ldap_get_entries($ldapconn, $sr);?>
<option SELECTED></option>
<?php for($i=0; $i<$info["count"];$i++){
echo '<option value="'.$info[$i]["cn"][0].'">'.$info[$i]["cn"][0].'</option>';
}
?>
';
</select></td>
</tr>
<tr align="left">
<td><strong><font face="arial" size="2">@email Emprunteur :</font></strong></td>
<td><INPUT TYPE="text" name="z_email" onfocus = "document.forms.emprunt_pp.z_email.blur()" value="<?php echo($mail);?>"></td>
</tr>
<tr align="left">
<td><strong><font face="arial" size="2">N° Inter.</font></strong></td>
<td><INPUT TYPE="text" name="z_actima"></td>
</tr>
<tr align="left">
<td><font face="arial" size="2">Technicien HDI</font></td>
<td><INPUT TYPE="text" name="z_tech" onfocus = "document.forms.emprunt_pp.z_tech.blur()" value="<?php echo($user);?>"></td>
</tr>
<table border="rules" align="center" cellspacing="0" cellpadding="5">
<tr bgcolor="#FBE9E9" align="left">
<td><font face="arial" size="2">Date - Dossier S.D.E</font></td>
<td><input type="text" size=8 name="z_date_act" onfocus = "document.forms.emprunt_pp.z_date_act.blur()" value="<?php echo($dat = "$day/$month/$year");?>"></td>
</tr>
<tr bgcolor="#F0FEF0"align="left">
<td><strong><font face="arial" size="2">Date - [Prêt jusqu'au ?]</font></td>
<td><input type="text" name="z_dateret" id='date' size="8" /><img src="image/cal.bmp" width="16" height="16" border="0" alt="Cliquez ici pour obtenir la date." id='for_date' onclick='showCalender(this)' /></a>
<font color="#C20808" face="arial" size="2"></font></td>
</tr>
<table border="0" align="center" cellspacing="2" cellpadding="2">
<tr align="center">
<td colspan="2"><input type="submit" name="prevalid" value="Valider"></td>
</tr>
</table>
</table>
</table>
</form>
<?php
}}//fin if
echo '<a href="?numlien=spare"><strong>Annuler [Back]</strong></a>';
?>
</body>
<?
mysql_close();
?>
</html> |