ok lo hice y me da un error...
fijate el form
Código PHP:
<form action="<?php echo $editFormAction; ?>" method="post" enctype="multipart/form-data" name="form1" onSubmit="MM_validateForm('descripcion','','R');return document.MM_returnValue">
<table align="center">
<tr valign="middle">
<td width="98" align="left" nowrap class="text1">Titulo</td>
<td width="267" align="left"><input name="titulo" type="text" class="todopanel" id="titulo" value="<?php echo $row_Recordset1['titulo']; ?>"></td>
</tr>
<tr valign="middle">
<td height="21" align="left" nowrap class="text1">Fecha</td>
<td align="left"><input name="fecha" type="text" class="todopanel" id="fecha" value="<?php echo $row_Recordset1['fecha']; ?>"></td>
</tr>
<tr valign="middle">
<td height="147" align="left" valign="top" nowrap class="text1">Contenido</td>
<td align="left" valign="middle"><textarea name="contenido" cols="50" rows="10" class="todopanel" id="contenido" ><?php echo nl2br $row_Recordset1['contenido']; ?></textarea></td>
</tr>
<tr valign="middle" class="text1">
<td colspan="2" align="left" nowrap class="Estilo8">Actualizar Imagen? <span class="todopanel"> Si
<input name="opcion" type="radio" value="1">
/No
<input name="opcion" type="radio" value="0" checked>
<input name="imagen" type="hidden" class="todopanel" value="<?php echo $row_Recordset1['imagen']; ?>" size="32">
<input name="imagen" type="file" class="todopanel" id="imagen">
</span></td>
</tr>
<tr valign="middle">
<td align="left" nowrap class="text1">Video URL</td>
<td align="left" nowrap class="Estilo8"><input name="video" type="text" class="todopanel" id="video" value="<?php echo $row_Recordset1['video']; ?>"></td>
</tr>
<tr valign="middle">
<td colspan="2" align="center" nowrap> </td>
</tr>
<tr valign="middle">
<td colspan="2" align="left" nowrap> <input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="id" value="<?php echo $row_Recordset1['id']; ?>"></td>
</tr>
<tr valign="middle">
<td align="left" nowrap> </td>
<td align="left"><input name="submit" type="submit" class="todopanel" value="Actualizar noticias"> </td>
</tr>
</table>
</form> </p>
y la cabezera
Código PHP:
<?php require_once('../Connections/azimut.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
if ($_POST['opcion']==1){
$ediciondir= '../images2/';
$uploaddir=$ediciondir;
if (!is_dir($ediciondir)) { mkdir($uploaddir, 0777); }
move_uploaded_file($_FILES['imagen']['tmp_name'], $uploaddir . $_FILES['imagen']['name']);
$filename = $_FILES['imagen']['name'];}
else {
$filename = $_POST['imagen'];
}
$updateSQL = sprintf("UPDATE noticias SET titulo=%s, fecha=%s, contenido=%s, imagen=%s, video=%s WHERE id=%s",
GetSQLValueString($_POST['titulo'], "text"),
GetSQLValueString($_POST['fecha'], "text"),
GetSQLValueString($_POST['contenido'], "text"),
GetSQLValueString($filename, "text"),
GetSQLValueString($_POST['video'], "text"),
GetSQLValueString($_POST['id'], "int"));
mysql_select_db($database_azimut, $azimut);
$Result1 = mysql_query($updateSQL, $azimut) or die(mysql_error());
$updateGoTo = "listado_noticias.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
$colname_Recordset1 = "1";
if (isset($_GET['id'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
}
mysql_select_db($database_azimut, $azimut);
$query_Recordset1 = sprintf("SELECT * FROM noticias WHERE id = %s", $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $azimut) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>