voici mon code
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
98
99
100
101
102
103
104
105
106
<?
include("../inc/config.php");
include("../inc/fonctions.php");
 
$req = mysql_query("SELECT id, pseudo, etat, mail, date_naissance, fonctions, localisation, avatar FROM users WHERE id=\"".$_GET["id"]."\"");
if (mysql_num_rows($req)==0)
{
  echo("SELECT id, pseudo, etat, mail, date_naissance, fonctions, localisation, avatar FROM users WHERE id=\"".$_GET["id"]."\"<br>Erreur !");
  exit();
}
 
if (isset($_GET["send"]))
{
  $ad_pseudo = htmlentities(addslashes(Return_POST($_POST['pseudo'])));
  $ad_etat = Return_POST($_POST['etat']);
  $ad_mail  = htmlentities(addslashes(Return_POST($_POST['mail'])));
  $ad_date_naissance  = htmlentities(addslashes(Return_POST($_POST['date_naissance'])));
  $ad_fonctions  = htmlentities(addslashes(Return_POST($_POST['fonctions'])));
  $ad_ville  = htmlentities(addslashes(Return_POST($_POST['ville'])));
  $ad_departement  = htmlentities(addslashes(Return_POST($_POST['departement'])));
  $ad_pays  = htmlentities(addslashes(Return_POST($_POST['pays'])));
  $ad_avatar = htmlentities(addslashes(Return_POST($_POST['avatar'])));
 
  $ad_localisation = "".$ad_ville." - ".$ad_departement." - ".$ad_pays."";
 
  $req = mysql_query("UPDATE users SET pseudo =\"$ad_pseudo\", etat=\"$ad_etat\", mail=\"$ad_mail\", date_naissance=\"$ad_date_naissance\", fonctions=\"$ad_fonctions\", localisation=\"$ad_localisation\", avatar=\"$ad_avatar\" WHERE id=\"".$_GET["id"]."\"") or die(mysql_error());
 
  header("location: modifier.php?msg=Insertion+effectué+avec+succès");
  exit();
}
else
{
	list($_GET["id"], $_POST["pseudo"], $_POST["etat"], $_POST["mail"], $_POST["date_naissance"], $_POST["fonctions"], $localisation, $_POST["avatar"]) = mysql_fetch_row($req);
	$tab = explode(" - ",$localisation);
	$_POST["ville"] = $tab[0];
	$_POST["departement"] = $tab[1];
	$_POST["pays"] = $tab[2];
}
?>
<html>
<head>
<title>Ajout d'un Utilisateur</title>
<link href="../inc/style.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#EBF1F1">
<?
if (isset($_GET["msg"]))
{
$msg = str_replace("+"," ",$_GET["msg"]);
$msg = stripslashes($msg);
echo("<div align=center class=msg>$msg<br><br><input onclick=parent.window.close() type=button value=Fermer></div>");
}
?>
<form action="modifier.php?id=<? echo($_GET["id"]); ?>&send=ok" method="post">
  <input type="hidden" name="action" value="send">
  <? echo $_GET["id"];?>
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0" class="champs">
    <tr> 
      <td height="30">Statut :</td>
      <td><select name="etat" id="etat" <? if($_SESSION['etat'] != 1) echo("disabled"); ?>>
          <option value="0" <?php if(!isset($_POST["etat"])) $_POST["etat"]= "0"; if ($_POST["etat"] == "0") echo("selected"); ?>>Membres</option>
          <option value="1" <?php if ($_POST["etat"] == "1") echo("selected"); ?>>Admin</option>
        </select> </td>
    </tr>
    <tr> 
      <td height="30">Pseudo :</td>
      <td><input type="text" name="pseudo" value="<?php echo($_POST["pseudo"]); ?>" size="45" <? if($_SESSION['etat'] != 1) echo("disabled"); ?>></td>
    </tr>
    <tr> 
      <td height="30">Avatar :</td>
      <td><input type="text" name="avatar" value="<?php if(isset($_POST["avatar"])) echo($_POST["avatar"]); ?>" size="45"></td>
    </tr>
    <tr> 
      <td height="30">Mail :</td>
      <td><input type="text" name="mail" value="<?php if(isset($_POST["mail"])) echo($_POST["mail"]); ?>" size="45"></td>
    </tr>
    <tr> 
      <td height="30">Date de naissance :</td>
      <td><input type="text" name="date_naissance" value="<?php if(isset($_POST["date_naissance"])) echo($_POST["date_naissance"]); ?>" size="45"></td>
    </tr>
    <tr> 
      <td height="30">Fonctions :</td>
      <td><input type="text" name="fonctions" value="<?php if(isset($_POST["fonctions"])) echo($_POST["fonctions"]); ?>" size="45"></td>
    </tr>
    <tr> 
      <td height="30">Ville :</td>
      <td><input type="text" name="ville" value="<?php if(isset($_POST["ville"])) echo($_POST["ville"]); ?>" size="45"></td>
    </tr>
    <tr> 
      <td height="30">D&eacute;partement :</td>
      <td><input type="text" name="departement" value="<?php if(isset($_POST["departement"])) echo($_POST["departement"]); ?>" size="45"></td>
    </tr>
    <tr> 
      <td height="30">Pays :</td>
      <td><input type="text" name="pays" value="<?php if(isset($_POST["pays"])) echo($_POST["pays"]); ?>" size="45"></td>
    </tr>
    <tr> 
      <td colspan="2"> <p>&nbsp;</p>
        <center>
          <input type="submit" value="Modifier">
        </center></td>
    </tr>
  </table>
</form>
</body>
</html>
mon pb est tres simple
on ouvre cette page par une url du type modifier.php?id=1 par exemple
la on a un formulaire qui est plus ou moins remplis ... mais correct

je le modifie je l'envoie mais on ne revoie pas l'id via l'url (pourtant l'id est bien transmis lors ed l'ouverture de la page

un echo de la requete donne
SELECT id, pseudo, etat, mail, date_naissance, fonctions, localisation, avatar FROM users WHERE id=""
Erreur !
et pourtant chose tres bizard la modification est bel est bien effectué

ça fait une heure que je teste plein de truc et ça fonctionne tjrs pas

merci de m'aider