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
| <?php
$BD_serveur = "localhost";
$BD_utilisateur = "root";
$BD_motDePasse = "";
$BD_base = "immo";
@mysql_pconnect($BD_serveur, $BD_utilisateur, $BD_motDePasse)
or die("Impossible de se connecter au serveur de bases de données.");
@mysql_select_db($BD_base)
or die("Impossible de se connecter à la base de données.");
$sql = "SELECT * FROM membre "; // requéte SQL
$req = mysql_query($sql) or die('<u>Probleme SQL</u> : '.$sql.'<br>'.mysql_error()); // envoie de la requéte
echo '<script type="text/javascript">
function test(test) {
var i = test.selectedIndex;
'$id='var id= test.options[i].value;';
$sql2 = "SELECT * FROM membre WHERE ID_MEMBRE='".$id."'"; // requéte SQL
$req2 = mysql_query($sql2) or die('<u>Probleme SQL</u> : '.$sql2.'<br>'.mysql_error());
echo'return true;
};
</script>';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="content-script-type" content="text/javascript"/>
<meta http-equiv="content-style-type" content="text/css"/>
<meta http-equiv="content-language" content="fr"/>
<title>ajout</title>
<link href="../css/style.css" rel="stylesheet" type="text/css" />
</head>
<body background="../img/mnbg.jpg">
<form action="enregistrer.php" method="post">
<fieldset class="fieldset">
<legend align="center"> <font face="Arial"><strong>Modifier utilisateur</strong></font></legend>
<table width="335" border="0" align="center">
<td scope="row"> utilisateur </td>
<td>
<select name="id_membre" id="id_membre" onchange="test(this)">
<option value=""></option>
<?php
while($resultat = mysql_fetch_array($req))
{
echo '<option value='.$resultat['ID_MEMBRE'].'>'.$resultat['NOM'].' '.$resultat['PRENOM'].'</option>';
}
'</select>
</td>
</tr>';
while($resultat2 = mysql_fetch_array($req2))
{
echo
' <tr>
<td width="109" height="37" scope="row">Nom</td>
<td width="210"><input name="nom" id="nom" type="text" value="'.$resultat2['NOM'].'" /></td>
</tr>
<tr>
<td scope="row">Prenom</td>
<td><input name="prenom" id="prenom" type="text" value="'.$resultat2['PRENOM'].'" /></td>
</tr>
<tr>
<td scope="row">CIN</td>
<td><input name="cin" id="cin" type="text" value="'.$resultat2['CIN'].'" /></td>
</tr>
<tr>
<td scope="row">Adresse</td>
<td><textarea name="adresse" id="adresse">'.$resultat2['ADRESSE'].'</textarea></td>
</tr>
<tr>
<td scope="row">statut</td>
<td>
<select name="statut" id="statut">
<option value="" selected="selected"> </option>
<option value="agent">Agent</option>
<option value="supperviseur">supperviseur</option>
</select>
</td>
</tr>
<tr>
<td scope="row">Tél</td>
<td><input name="tel" type="text" id="tel" value="'.$resultat2['TEL'].'/></td>
</tr>';
}
?>
</table>
</fieldset>
<div class="nv"><div class="boutton1" align="right">
<input type="submit" name="enregisrer" value="Enregisrer" />
</div></div>
</form>
</body>
</html> |
Partager