Page 1 sur 1

probleme de formulaire qui n'update pas les valeurs

Posté : 06 nov. 2009, 19:08
par yberges
hello a tous voila j'ai un formulaire qui update une valeur dans un bdd.
j'ai changer d'hébergeur et depuis si je colle mon code dans mon champ l'update ne ce fait pas ....
voici le code

Code : Tout sélectionner

<?php //initialize the session if (!isset($_SESSION)) { session_start(); } ?> <?php if (isset($_GET['id_newsletter'])) { require_once('config.inc.php'); $val = intval($_GET['id_newsletter']); $requete=mysql_query("SELECT objet, contenu FROM n_newsletters WHERE id_newsletter='$val'"); $result=mysql_query ($requete); list($objetnews,$cont)=mysql_fetch_row($requete); } ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Modification newsletter</title> </head> <body> <?php // ANTI-INJECTION SQL + XSS function protection($valeur) { $valeur = stripslashes($valeur); $valeur = htmlspecialchars($valeur); $valeur = htmlentities($valeur); return @mysql_real_escape_string($valeur); } ?> <link rel="stylesheet" href="admin.css" type="text/css"/> <form method="post" name="form1" action="PubLetter.php"> <table align="center"> <tr valign="baseline"> <td nowrap align="right">Modif objet:</td> <td><input type="text" name="Objet" id="Objet" value="<?php echo "$objetnews"; ?>" size="106"></td> </tr> <tr valign="baseline"> <td nowrap align="right" valign="top">Modif contenu:</td> <td><textarea name="Contenu" id="Contenu" cols="80" rows="12"><?php echo "$cont"; ?></textarea> </td> </tr> <tr valign="baseline"> <td nowrap align="right">&nbsp;</td> <td><input type="submit" value="MAJ newsletter !"></td> </tr> </table> </form> <?php require(config.inc.php); if (isset($_POST['Objet'])) { if(mysql_errno()==0) { if ($_POST['Objet']!="") { $valeur = protection($_POST['Objet']); $val = intval($_GET['id_newsletter']); mysql_query ("UPDATE n_newsletters SET objet='$valeur' WHERE id_newsletter='$val'"); } } } if (isset($_POST['Contenu'])) { if(mysql_errno()==0) { if ($_POST['Contenu']!="") { $valeur = protection($_POST['Contenu']); $val = intval($_GET['id_newsletter']); mysql_query ("UPDATE n_newsletters SET contenu='$valeur' WHERE id_newsletter='$val'"); } } } if (isset($_POST['Objet']) || isset($_POST['Contenu']) ) { echo "<meta http-equiv='Refresh' content='0;URL='modif_newsletter.php?id_newsletter='$val''>"; } mysql_close(); ?> <b>Retour sous admin : </b><a href="admin_newsletter.php"><u>Admin</u></a></u></b> </body> </html>
si j'écris dans mon champ pas de probleme
si je colle ceci

Code : Tout sélectionner

<div> <div>&nbsp;</div> <span style="font-family: Arial;"><font size="-1"> <table width="500" cellspacing="0" cellpadding="0" border="0" align="center"> <tbody> <tr> <td> <div><span style="font-family: Courier New;"><span style="font-size: 10pt;">Bonjour,</span></span></div> <span style="font-family: Courier New;"> <font size="2"><span style="font-size: 10pt;">Nous avons &eacute;t&eacute; plusieurs jours sans possibilit&eacute; de communiquer via notre site internet ou nos adresses professionnelles, suite &agrave; quelques probl&egrave;mes avec notre h&eacute;bergeur net.</span></font></span> <span style="font-family: Courier New;"> <font size="2"><span style="font-size: 10pt;">Veuillez nous excuser pour cet inconv&eacute;nient. </span></font></span> <span style="font-family: Courier New;"> <p><font size="2"><span style="font-size: 10pt;">Les mails que vous avez pu nous envoyer durant cette p&eacute;riode vous ont &eacute;t&eacute; retourn&eacute;s. Merci de nous&nbsp; les renvoyer si n&eacute;cessaire.</span></font></p> </span> <span style="font-family: Courier New;"> <p><font size="2"><span style="font-size: 10pt;">Tout &eacute;tant revenu &agrave; la normale, &agrave; tr&egrave;s bient&ocirc;t&nbsp;!</span></font></p> </span> <span style="font-family: Courier New;"> <div><font size="2"><span style="font-size: 10pt;">L&rsquo;&eacute;quipe du <u>bbb</u>.</span></font></div> </span> <p>&nbsp;</p> <span style="font-family: Courier New;"> <p><font size="2"><span style="font-size: 10pt;">prochains &eacute;v&egrave;nements au <u>bbb</u>&nbsp;:</span></font></p> </span> <span style="font-family: Courier New;"> <p><font size="2"><span style="font-size: 10pt;">&sect; Vernissage ce mardi soir de l&rsquo;exposition de Florence Garrabe, exposition visible jusqu&rsquo;au 5 d&eacute;cembre</span></font></p> </span> <span style="font-family: Courier New;"> <p><font size="2"><span style="font-size: 10pt;">&sect; Petit salon de l&rsquo;art contemporain &laquo;&nbsp;Mais qu&rsquo;est-ce que je pourrai bien lui offrir&nbsp;? #4&nbsp;&raquo; vendredi 11 d&eacute;cembre de 17h &agrave; 22h, samedi 12 d&eacute;c. de 14h &agrave; 18h | avec la sortie du livre d&rsquo;artistes <i><span style="font-style: italic;">Play it again &nbsp;|</span></i> collectif | Editions bbb, fais-moi de l&rsquo;art&nbsp;</span></font></p> </span><span style="font-family: Courier New;"> <p><font size="2"><span style="font-size: 10pt;">&sect; Exposition en ligne de St&eacute;phane Benault, <i><span style="font-style: italic;">thesecretblock.over-blog.com</span></i></span></font></p> </span> <span style="font-family: Courier New;"> <p><font size="2"><span style="font-size: 10pt;">&sect; Lancement de l&rsquo;appel &agrave; projet <i><span style="font-style: italic;">Place publique</span></i></span></font></p> </span><span style="font-family: Times New Roman;"> <span> <br /> </span></span></td> </tr> <tr> <td> <table width="500" cellspacing="0" cellpadding="1" border="0" align="center" style=""> <tbody> <tr> </tr> <tr> <td valign="top" align="left"><span style="font-family: Arial;"><font size="-1">&nbsp;<span style="font-size: large;"><u><span style="font-family: Courier New;">bbb</span></u></span><span style="font-family: Courier New;"> centre d&rsquo;art | centre r&eacute;gional d'initiatives pour l'art contemporain<br /> t&eacute;l.&nbsp;: 05 61 13 37 14</span><u1:p></u1:p><span style="font-family: Courier New;"> <br /> <a target="_blank" href="http://www.lebbb.org">www.lebbb.org</a><br /> [email protected]</span></font></span></td> </tr> </tbody> </table> </td> </tr> <tr> <td><span style="font-family: Arial;"><font size="-1"><span style="font-family: Arial;"><font size="-1"><br /> </font></span></font></span>&nbsp;</td> </tr> </tbody> </table> <br /> </font> </span></div>
les valeurs ne passe pas .....
si qqun pouvez m'aider ?
Merci par avance

Re: probleme de formulaire qui n'update pas les valeurs

Posté : 13 nov. 2009, 20:03
par christele
Houla ! ton serveurs était un vieux clou, car

$valeur = stripslashes($valeur); // Supprime les antislashs d'une chaîne quand magic_quotes_gpc est a on, ors cette fonction est obselete
d'autre part:
quand magic_quotes_sybase est activée, aucun antislash n'est supprimé, mais deux apostrophes sont remplacées par une seule à la place.

Re: probleme de formulaire qui n'update pas les valeurs

Posté : 14 nov. 2009, 14:40
par yberges
cool merci !
ca marche maintenant !
a+