Ainda não coloquei o script para verificar a imagem, apaga-la do BD e fazer o upload da nova imagem, está apenas a função para pegar as váriaveis e fazer o update no BD. Segue abaixo o código:
<?php
require_once("verifica.php");
include ("include/conecta.php");
include("fckeditor/fckeditor2.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...nsitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
</head>
<body>
<form action="" method="post" enctype="multipart/form-data" name="form">
<?php
$id = (int)$_GET["id"];
$titulo = isset($_POST['titulo']) ? $_POST['titulo'] : '';
$texto = isset($_POST["texto"]) ? $_POST["texto"] : '';
if(isset($_POST['submit'])){
$chk = $_POST["status"];
if($chk!="") {
foreach($chk as $valores) {
echo "Status checkbox - $valores <br>";
}
}
$dados = "UPDATE gvnews SET titulo='$titulo',texto='$texto' WHERE id='$id'";
$resultado = mysql_query($dados) or die ("Não foi possível realizar a consulta ao banco de dados");
$msg = "Notícia editada com sucesso!";
}
$dados1 = mysql_query("SELECT * FROM gvnews WHERE id=$id");
while($linha=mysql_fetch_array($dados1)) {
$id = $linha["id"];
$titulo = $linha["titulo"];
$texto = $linha["texto"];
?>
<?php
if(isset($msg)){
echo $msg;
}
?>
<table>
<tr>
<td>Titulo:</td>
<td>
<input name="titulo" type="text" value="<?php echo $titulo ?>" size="75">
</td>
</tr>
<tr>
<td>Texto:</td>
<td>
<?php
$oFCKeditor = new FCKeditor('texto');
$oFCKeditor->BasePath = 'fckeditor/';
$oFCKeditor->Value = "$texto" ;
$oFCKeditor->Create();
?> </td>
</tr>
<td>Imagem:</td>
<td rowspan="2">
<table width='500' border='0' cellspacing='0' cellpadding='0'>
<tr>
<?php
$dados2 = mysql_query("SELECT * FROM gvnews_img WHERE id_news=$id ORDER BY id");
while($linha2=mysql_fetch_array($dados2)) {
$id_img = $linha2["id"];
$imagem = $linha2["imagem"];
echo "<td><img src='thumb.php?imagem=../$imagem' width='100' height='100' alt='$id_img'>";
echo "<br>";
echo "<input name='status[]' type='checkbox' value='$id_img'/>Trocar imagem</td>";
}
}
?>
</tr>
</table>
</td>
</tr>
<tr>
<td> </td>
<tr>
<td>Imagem 1:</td>
<td>
<input name="fotos[]" type="file" size="63">
</td>
</tr>
<tr>
<td>Imagem 2:</td>
<td>
<input name="fotos[]" type="file" size="63">
</td>
</tr>
<tr>
<td>Imagem 3:</td>
<td>
<input name="fotos[]" type="file" size="63">
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="submit" value="Editar">
<input type="reset" name="reset" value="Limpar Formulario">
</td>
</tr>
</table>
</form>
</body>
</html>