Je cherche dans la cadre d'un projet pour mon entreprise de faire un menu deroulant en php où j'aurai le choix entre les differents nom des clients pour pouvoir obtenir leurs informations.Voici la page que j'ai faite:
<?php
include "connexion.inc.php";
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html/php; charset=utf-8" />
</head>
<body>
<form method="post" action="test2.php" name="client">
<?php
$sql="SELECT Raison_sociale FROM client ORDER BY Client_id ";
$resultat=@mysql_query($sql,$id_link);
echo '<select name="client">';
echo '<option value="" selected></option>';
while ($rang=mysql_fetch_array($resultat)){
$client_id=$rang['Client_id'];
$raison_sociale=$rang['Raison_sociale'];
echo "<option value=\"$client_id\">$raison_sociale</option>";
}
echo '</select>';
?>
<input type="submit" name="Envoyez">
<?php
if(isset($_POST['client'])) {
$client = htmlentities($_POST['client']);
$reponse = mysql_query("SELECT * FROM client WHERE Raison_sociale = '". $client ."'");
$donnees = mysql_fetch_array($reponse);
?>
<br>
<br>
<br>
<br>
Code postal:<input id="codepostal" type="text" name="name" maxlength="50" size="10" value="<?php echo $donnees['Adresse_CP'] ?>">
</form>
<?php
}
?>
</body>
</html>
Mon soucis est que quand je selectionne le nom et que je clique sur envoyé,la valeur du champs "code postal" reste totalement vide:/.Merci d'avance pour votrre aide
