Bonjour,

Quand je veux modifier une donnée via un formulaire (php), bizarrement le formulaire apparait complètement vide. Donc, sans aucune donnée dessus. Et là vous comprenez bien que c'est impossible de faire la modification ! Y a-t-il quelqu'un pour m'épauler SVP !

Voici le code pour la modification :

Code php : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
//---------------------------- connexion avec la base de données
require_once("connectionMYSQL.inc.php");
//----------------------------- requête pour la modification
if(isset($_POST['modif'])){
$requete = "UPDATE client SET nom = '".$_POST['nom']."',prenom = '".$_POST['prenom']."',etatcivil = '".$_POST['etatcivil']."',nationalite= '".$_POST['nationalite']."',adresse = '".$_POST['adresse']."',telephone = '".$_POST['telephone']."',occupation = '".$_POST['occupation']."',sexe = '".$_POST['sexe']."' WHERE IdClient ='".$_POST['IdClient']."' ";
$resultat = mysql_query($requete);
}
//---------------------requête de recherche
$requete2 = "SELECT * FROM client WHERE IdClient='".$_POST['IdClient']."'";
$resultat2 = mysql_query($requete2);
$produit = mysql_fetch_array($resultat2);
?>


Et le formulaire est le suivant :


Code html : 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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<title>Modification des clients</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href= "style.css" type = "text/css" rel = "stylesheet"/>
</head>
<body>
<form align= "center" id="monform" name = "form1" method = "post" action="updateClient.php" >
<table>
<tr>
<td>IdClient:</td>
<td><input type="hidden" name="IdClient" value="<?php echo $client['IdClient']; ?>"></td>
</tr>
<tr>
<td>Nom:</td>
<td><input type="text" name="nom" value="<?php echo $client['nom']; ?>"></td>
</tr>
<tr>
<td>Prenom:</td>
<td><input type="text" name="prenom" value="<?php echo $client['prenom']; ?>"></td>
</tr>
<tr>
<td>Etat Civil:</td>
<td><input type="text" name="etatcivil" value="<?php echo $client['etatcivil']; ?>"></td>
</tr>
<tr>
<td>Nationalite:</td>
<td><input type="text" name="nationalite" value="<?php echo $client['nationalite']; ?>"></td>
</tr>
<tr>
<td>Adresse:</td>
<td><input type="text" name="adresse" value="<?php echo $client['adresse']; ?>"></td>
</tr>
<tr>
<td>Telephone:</td>
<td><input type="text" name="telephone" value="<?php echo $client['telephone']; ?>"></td>
</tr>
<tr>
<td>Occupation:</td>
<td><input type="text" name="occupation" value="<?php echo $client['occupation']; ?>"></td>
</tr>
<tr>
<td>Sexe:</td>
<td><input type="text" name="sexe" value="<?php echo $client['sexe']; ?>"></td>
</tr>
<tr>
<td><input type="submit" name="modifier" value="Modifier"></td>
</tr>
</table>
</form>
<?php include("footer.php")?>
</body>
</html>

Aurai-je glissé une erreur quelque part ?

Merci d'avance pour votre aide.