Bonjour,
J'ai une page EditClient ou je remplis une liste déroulante de mes clients via une base de données (jusque là pas de problèmes). J'aimerais ensuite remplir mes champs adresse,ville,tel etc... du client lorsque je selectionne mon client via ma liste.
Je vous propose mon code ci-dessous :

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
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
 
<html>
<body style="font: bold; font-size: x-small; font-weight: bold; font-family: Verdana; text-align: center" >
<head></head>
 
<STYLE TYPE="text/css">
<!--
INPUT {color: #CC0000; background-color: #FFCC00; font-size: 10px; font-family: verdana; border: none; font: bold}
SELECT {color:#CC0000;background-color:#FFCC00;font-size:10px;font-family:verdana;}
H1 {font-family: Verdana; font-size: x-small; font: bold}
H2 {font-family: Verdana; font-size: x-small; font: bold; color: white}
-->
</style>
<?php include ('menu.php'); ?>
<? 
		$link = mysql_connect("localhost", "root", "");
		mysql_select_db("baseclients", $link) or die(mysql_error()); 
 
		$req = "SELECT NOM FROM clients ORDER BY NOM";
		$result = mysql_query($req);
 
?>
<!-- Ici on a créé un tableau pour la banniere -->
<table border="0" align="center" width="80%" height="15%" background="img/energybliss.jpg">
	<tr>
		<td></td> 
	</tr>
</table>
 
<br><br><br><center>
<!-- Ici on a créé un tableau pour la form Nouveau client -->
<table border="0" align="center" width="65%">
	<tr>
	<td width="100%" align="left">
 
		<table bgcolor="#336633" width="355" style="font-size: x-small" align="center">
		  	<tr>
    		<td align="left"><h2>Edition d'un Client</td>
  			</tr>
		</table><br>
 
		<table border="0" align="center" cellspacing="0" bordercolor="#FFFFFF" style="background-color: #FFFF99; border: medium">
			<tr>
			<td><h1>Nom client :</td>
			<td><select name="nom_client" id="nom_client">
				<?
				while ($oResult = mysql_fetch_object($result)) {	  
					echo "<option value=\"$oResult->NOM\">$oResult->NOM</option> " ; }  
					echo "<option value=\"Choisir un élément\" selected>Choisir un élément</option> " ;	
				?>
			</td></select>
			</tr>		
			<tr>
			<td><h1>Adresse :</td>
			<td><? echo"<input type='text' name='adresse_client' size='40' maxlength='256' value='toto'>";?></td>
			</tr>
			<tr>
			<td><h1>Code Postal :</td>
			<td><input type="text" name="cp_client" size="5" maxlength="256"></td>
			</tr>
			<tr>
			<td><h1>Ville :</td>
			<td><input type="text" name="ville_client" size="40" maxlength="256"></td>
			</tr>
			<tr>
			<td><h1>Téléphone :</td>
			<td><input type="text" name="tel_client" size="12" maxlength="256"></td>
			</tr>
			<tr>
			<td><h1>Télécopie :</td>
			<td><input type="text" name="fax_client" size="12" maxlength="256"></td>
			</tr>
			<tr>
			<td><h1>Contact :</td>
			<td><input type="text" name="contact_client" size="40" maxlength="256"></td>
			</tr>
			<tr>
			<td><h1>E-mail :</td>
			<td><input type="text" name="mail_client" size="40" maxlength="256"></td>
			</tr>
 
			<tr>
			<td><h1>Famille :</td>
			<td><input type="text" name="famille_client" size="40" maxlength="256"></td>
			</tr>
 
	</table>
	<center>
	<br><br>
	<INPUT TYPE="submit" VALUE="Enregistrer" STYLE="color: #000000; background-color: #FF6600; font-size: 12px; font-family: arial; font-weight: bold; border-width: 1; width: 110px; text-align: center; border-color: black">
	<INPUT TYPE="button" VALUE="Annuler" STYLE="color: #000000; background-color: #FF6600; font-size: 12px; font-family: arial; font-weight: bold; border-width: 1; width: 110px; text-align: center; border-color: black">
 
		</td>
	</tr>
</table>
</form>
</html>
Merci