bonjour,

j'ai une liste de clients remplie à partir de la base de donnée,
et au dessous j'ai un formulaire dont les valeurs des champs doivent varier à chaque fois on change la selection dans la liste des clients. comment faire pour extraire les données de la tables clients et les mettre dans l'attribut value des champs du formulaire

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
 
<?php
$query = "SELECT * FROM `ag`";
mysql_query("SET NAMES 'UTF8'");
$res = mysql_query($query) or die(mysql_error());
 
echo "
<select name=liste_ag id=liste_ag
onchange=show_modif_form(this.value);tt();>
";
echo "<option value=choisir>Choississez une agence...</option>";
 
while($cat = mysql_fetch_array($res))
{
	echo "<option value='".$cat['id_ag']."'>";echo $cat['nom_ag'];
	echo "</option>";
}
echo "</select>";echo "<p>";
?>
<html>
<head>
<script type="text/javascript">
function dd(elt)
{
ind = elt.options[elt.options.selectedIndex].index;
return ind;
}
function show_modif_form(texte)
{
if (texte != "choisir")
document.getElementById("ajout_ag").style.visibility='visible';
else
document.getElementById("ajout_ag").style.visibility= 'hidden';
}
</script>
</head>
<body>
<form name="ajout_ag" id="ajout_ag" action="modifier_ag.php" method="post">
  <table >
  <tr>
    <td><p>Nom de l'agent:</p></td>
    <td><input type="text" name="nom_ag" value="<?php ; ?>">&nbsp;</td>
    </tr>
  <tr>
    <td><p>Adresse:</p></td>
    <td><input type="text" name="adr" value="<?php echo ; ?>">&nbsp;</td>
    </tr>
  <tr>
    <td><p>Code&nbsp;postal:</p></td>
    <td><input type="text" name="code_postal" value="<?php  ?>">&nbsp;</td>
    </tr>
  <tr>
    <td><p>Ville:</p></td>
    <td><input type="text" name="ville" value="<?php  ?>">&nbsp;</td>
    </tr>
  <tr>
    <td><p>Téléphone:</p></td>
    <td><input type="text" name="tel1" value="<?php  ?>">&nbsp;</td>
    </tr>
  <tr>
    <td><p>Téléphone 2:</p></td>
    <td><input type="text" name="tel2" value="<?php  ?>">&nbsp;</td>
    </tr>
  <tr>
    <td><p>Email:</p></td>
    <td><input type="text" name="email" value="<?php  ?>">&nbsp;</td>
    </tr>
    </tr>
  <tr>
  	<td colspan="2" align="center"><input type="submit" name="submit" value="Modifier" />
    <input type="button" name="annuler" value="Annuler"></td>  
  </tr>
</table>
</form>
</body>
</html>
cordialement,