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
| <?php
if(!empty($_POST))
{
extract($_POST);
$sql="UPDATE news SET image='$image', titre='$titre', contenu='$contenu' WHERE id=$id";
$req=mysql_query($sql) or die(mysql_error());
header('location:gestionnews.php');
// $_GET["id"]=$id; à supprimer car visiblement inutile mais à vérifier
}
$sql="SELECT * FROM news WHERE id={$_GET["id"]}";
$req=mysql_query($sql) or die(mysql_error());
$data=mysql_fetch_assoc($req);
?>
<form method="post" action="edit.php" enctype="multipart/form-data"/>
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
Image :<input type="file" name="image" value="<?php echo $data["image"]; ?>" />
<input type="hidden" input name="id" value="<?php echo $data["id"]; ?>" />
Titre :<input type="text" name="titre" value="<?php echo $data["titre"]; ?>" />
<br>
Contenu :<br>
<textarea name="contenu" style="width:100%;height:150px;"> <?php echo $data["contenu"]; ?> </textarea>
<input type="submit" value="OK" />
</form> |
Partager