par
philoult » 15 nov. 2005, 17:49
Bonjour,
je voudrait faire une page de mise a jour de données.
J'arrive bien à récupérer mes données dans un page par contre lorsque j'envoi la modif j'ai un retour d'erreur.
Voici le code:
<?php
$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE coloc SET `PEC`=%s, finddp=%s, IDFACUSAGE=%s, acces_debit=%s, commentaire=%s WHERE societe=%s",
GetSQLValueString($POST['PEC'], "text"),
GetSQLValueString($POST['finddp'], "text"),
GetSQLValueString($HTTP_POST_VARS['IDFACUSAGE'], "text"),
GetSQLValueString($HTTP_POST_VARS['acces_debit'], "text"),
GetSQLValueString($HTTP_POST_VARS['commentaire'], "text"));
mysql_select_db($base, $connexion);
$Result1 = mysql_query($updateSQL, $connexion) or die(mysql_error());
$updateGoTo = "confirmation-operation.htm";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
mysql_select_db($base, $connexion);
$query_modifclient = "SELECT * FROM coloc WHERE societe='$societe'";
$modifclient = mysql_query($query_modifclient, $connexion) or die(mysql_error());
$row_modifclient = mysql_fetch_assoc($modifclient);
$totalRows_modifclient = mysql_num_rows($modifclient);
mysql_free_result($modifclient);
?><body>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<p align="center"><strong><em><u><i><b><font color="#993333" size="6">Modification
des Infos Client</font></b></i></u></em></strong></p>
<table width="600" height="988" align="center">
<tr valign="baseline">
<td width="100" align="right" nowrap><font size="-1" face="Arial, Helvetica, sans-serif">Date
PEC:</font></td>
<td><font size="-1" face="Arial, Helvetica, sans-serif">
<input type="text" name="date_PEC" value="<?php echo $row_modifclient['PEC']; ?>" size="32">
</font></td>
<td width="100" align="right" nowrap><font size="-1" face="Arial, Helvetica, sans-serif">Date
d instal:</font></td>
<td><font size="-1" face="Arial, Helvetica, sans-serif">
<input type="text" name="date_d_instal" value="<?php echo $row_modifclient['finddp']; ?>" size="32">
</font></td>
</tr>
<tr valign="baseline">
<td width="100" align="right" nowrap><font size="-1" face="Arial, Helvetica, sans-serif">IDFACUSAGE:</font></td>
<td><font size="-1" face="Arial, Helvetica, sans-serif">
<input type="text" name="IDFACUSAGE" value="<?php echo $row_modifclient['IDFACUSAGE']; ?>" size="32">
</font></td>
<td width="100" align="right" nowrap><font size="-1" face="Arial, Helvetica, sans-serif">accès
/ débit:</font></td>
<td><font size="-1" face="Arial, Helvetica, sans-serif">
<input type="text" name="acces_debit" value="<?php echo $row_modifclient['acces_debit']; ?>" size="32">
</font></td>
</tr>
<tr valign="baseline">
<td width="100" align="right" nowrap><font size="-1" face="Arial, Helvetica, sans-serif">Commentaire:</font></td>
<td><font size="-1" face="Arial, Helvetica, sans-serif">
<input type="text" name="commentaire" value="<?php echo $row_modifclient['commentaire']; ?>" size="32">
</font></td>
</tr>
<tr valign="baseline">
<td width="100" align="right" nowrap> </td>
<td><input type="submit" value="Mettre à jour l'enregistrement"></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="ddp" value="<?php echo $row_modifclient['societe']; ?>">
</form>
et voici le message d'erreur:
Notice: Undefined variable: POST in c:\easyphp\www\consultation\modifcoloc.php on line 50
Notice: Undefined variable: POST in c:\easyphp\www\consultation\modifcoloc.php on line 51
Warning: sprintf(): Too few arguments in c:\easyphp\www\consultation\modifcoloc.php on line 54
Query est vide
Avez vous une idée de mon pb
Bonjour,
je voudrait faire une page de mise a jour de données.
J'arrive bien à récupérer mes données dans un page par contre lorsque j'envoi la modif j'ai un retour d'erreur.
Voici le code:[php]
<?php
$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE coloc SET `PEC`=%s, finddp=%s, IDFACUSAGE=%s, acces_debit=%s, commentaire=%s WHERE societe=%s",
GetSQLValueString($POST['PEC'], "text"),
GetSQLValueString($POST['finddp'], "text"),
GetSQLValueString($HTTP_POST_VARS['IDFACUSAGE'], "text"),
GetSQLValueString($HTTP_POST_VARS['acces_debit'], "text"),
GetSQLValueString($HTTP_POST_VARS['commentaire'], "text"));
mysql_select_db($base, $connexion);
$Result1 = mysql_query($updateSQL, $connexion) or die(mysql_error());
$updateGoTo = "confirmation-operation.htm";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
mysql_select_db($base, $connexion);
$query_modifclient = "SELECT * FROM coloc WHERE societe='$societe'";
$modifclient = mysql_query($query_modifclient, $connexion) or die(mysql_error());
$row_modifclient = mysql_fetch_assoc($modifclient);
$totalRows_modifclient = mysql_num_rows($modifclient);
mysql_free_result($modifclient);
?><body>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<p align="center"><strong><em><u><i><b><font color="#993333" size="6">Modification
des Infos Client</font></b></i></u></em></strong></p>
<table width="600" height="988" align="center">
<tr valign="baseline">
<td width="100" align="right" nowrap><font size="-1" face="Arial, Helvetica, sans-serif">Date
PEC:</font></td>
<td><font size="-1" face="Arial, Helvetica, sans-serif">
<input type="text" name="date_PEC" value="<?php echo $row_modifclient['PEC']; ?>" size="32">
</font></td>
<td width="100" align="right" nowrap><font size="-1" face="Arial, Helvetica, sans-serif">Date
d instal:</font></td>
<td><font size="-1" face="Arial, Helvetica, sans-serif">
<input type="text" name="date_d_instal" value="<?php echo $row_modifclient['finddp']; ?>" size="32">
</font></td>
</tr>
<tr valign="baseline">
<td width="100" align="right" nowrap><font size="-1" face="Arial, Helvetica, sans-serif">IDFACUSAGE:</font></td>
<td><font size="-1" face="Arial, Helvetica, sans-serif">
<input type="text" name="IDFACUSAGE" value="<?php echo $row_modifclient['IDFACUSAGE']; ?>" size="32">
</font></td>
<td width="100" align="right" nowrap><font size="-1" face="Arial, Helvetica, sans-serif">accès
/ débit:</font></td>
<td><font size="-1" face="Arial, Helvetica, sans-serif">
<input type="text" name="acces_debit" value="<?php echo $row_modifclient['acces_debit']; ?>" size="32">
</font></td>
</tr>
<tr valign="baseline">
<td width="100" align="right" nowrap><font size="-1" face="Arial, Helvetica, sans-serif">Commentaire:</font></td>
<td><font size="-1" face="Arial, Helvetica, sans-serif">
<input type="text" name="commentaire" value="<?php echo $row_modifclient['commentaire']; ?>" size="32">
</font></td>
</tr>
<tr valign="baseline">
<td width="100" align="right" nowrap> </td>
<td><input type="submit" value="Mettre à jour l'enregistrement"></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="ddp" value="<?php echo $row_modifclient['societe']; ?>">
</form>
[/php]
et voici le message d'erreur:
[quote]
Notice: Undefined variable: POST in c:\easyphp\www\consultation\modifcoloc.php on line 50
Notice: Undefined variable: POST in c:\easyphp\www\consultation\modifcoloc.php on line 51
Warning: sprintf(): Too few arguments in c:\easyphp\www\consultation\modifcoloc.php on line 54
Query est vide[/quote]
Avez vous une idée de mon pb