Je ne vois pas du tout d'ou vient l'erreur car je me suis inspirée du code pour l'ajout des news et de l'image qui marche super bien..Le fichier n'a pas été uploadé (trop gros ?)
Merci de votre aide..
Voici mon code pour la modif des news (je l'ai fait à partir d'un tutorial dans un bouquin sur php/mysql) :
<?php
//INFORMATION ENVOYEE PAR URL (GET)
if(isset($_GET['id'])) $id=$_GET['id']; else $id=0;
// INITIALISATION DES VARIABLES
if(isset($_POST['auteur'])) $auteur=$_POST['auteur']; else $auteur="";
if(isset($_POST['titre'])) $titre=$_POST['titre']; else $titre="";
if(isset($_POST['date'])) $date=$_POST['date']; else $date="";
if(isset($_POST['news'])) $news=$_POST['news']; else $news="";
if(isset($_POST['image'])) $monchemin=$_POST['image']; else $monchemin="";
if(isset($_POST['action'])) $action=$_POST['action']; else $action="";
if(isset($_POST['idform'])) $idform=$_POST['idform']; else $idform=0;
//CONNEXION ET SÉLECTION DE LA BASE
require_once('maconnexion.php');
mysql_select_db($db_maconnexion, $connexionwir);
//TESTE SI ENVOI DEPUIS FORMULAIRE
if($action=="modif") {
$repertoireDestination = "img/";
$nomDestination = $monfichier_name;
$chemin= $repertoireDestination.$nomDestination;
// Pour raison de sécurité nous ajouterons aux fichiers
// portant une extension .php .php3, l'extension .txt
if (isset($monfichier)) {
if (rename($monfichier,
$repertoireDestination.$nomDestination)) {
echo "Le fichier temporaire ".$monfichier.
" a été déplacé vers ".$repertoireDestination.$nomDestination;
} else {
echo "Le déplacement du fichier temporaire a échoué".
" vérifiez l'existence du répertoire ".$repertoireDestination;
}
} else {
echo "Le fichier n'a pas été uploadé (trop gros ?)";
}
//REQUETE SQL
$updatenewsbox = "UPDATE newsbox SET
auteur='".$auteur."',
titre='".$titre."',
date='".$date."',
image='".$chemin."',
news='".$news."'
WHERE id=".$idform ;
//SOUMISSION REQUETTE
mysql_query($updatenewsbox, $connexionwir) or die(mysql_error());
}
//RECUPÉRATION DES VALEURS INITIALES DES CHAMPS
$query_rsListenewsbox = "SELECT * FROM newsbox WHERE id=".$id." ORDER BY id";
$rsListenewsbox = mysql_query($query_rsListenewsbox, $connexionwir) or die(mysql_error());
$row_rsListenewsbox = mysql_fetch_assoc($rsListenewsbox);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Modification de News</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<form action="modif-news.php" method="post" name="form-news" id="form-news">
<p>MODIFICATION DES NEWS
<p><a href="ajout-news.php">Ajout de News </a>
<p><a href="gestion-news.php">Gestion de News
</a>
<table width="400" border="0">
<tr>
<td>Auteur</td>
<td><input type="text" name="auteur" id="auteur" value="<?php echo $row_rsListenewsbox['auteur'];?>"></td>
</tr>
<tr>
<td>Titre</td>
<td><input type="text" name="titre" id="titre" value="<?php echo $row_rsListenewsbox['titre'];?>"></td>
</tr>
<tr>
<td>Date</td>
<td><input name="date" type="text" maxlength="10" id="date" value="<?php echo $row_rsListenewsbox['date'];?>"></td>
</tr>
<tr>
<td>News</td>
<td><input name="news" type="text" id="news" value="<?php echo $row_rsListenewsbox['news'];?>" size="100"></td>
</tr>
<tr>
<td>Photo</td>
<td><input type="hidden" name="MAX_FILE_SIZE" value="10000000" /><input name="monfichier" type="file" id="monfichier" value="<?php echo $row_rsListenewsbox['image'];?>"/></td>
</tr>
<tr>
<td> </td>
<td><input name="action" type="hidden" id="action" value="modif">
<input name="idform" type="hidden" id="idform" value="<?php echo $row_rsListenewsbox['id'];?>" >
<input type="submit" name="envoyer" value="Envoyer"></td>
</tr>
</table>
<p>
<p>
<br>
<p> <br>
<br>
<br>
<br>
</p>
</form>
</body>
</html>