Este es el script:
Código PHP:
<?
if (isset($_SESSION['admin'])) {
include("../config.php");
if(isset($_POST['modificar'])){
$horario = $_POST['horario'];
$titulo = $_POST['titulo'];
$sql = "UPDATE programas set horario='$horario', titulo='$titulo'";
$res = mysql_query($sql) or die("Error: ".mysql_error());
echo '<h2>Se han guardado los cambios introducidos.</h2>';
}
?>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td><form action="index.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
<? $con = mysql_query("SELECT * FROM programas ORDER BY id DESC") or die("Error: ".mysql_error());
if(mysql_num_rows($con) == NULL) {
echo 'No existe ninguna programacion.';
}else{
echo '<table width="100" border="0" align="center" cellpadding="0" cellspacing="5">
';
while($datos = mysql_fetch_array($con)) {
echo '<tr><td width="1"><input name="horario" type="text" class="file" size="10" maxlength="10" value="'.$datos[horario].'"></td>
<td width="99"><input name="titulo" type="text" class="file" size="70" value="'.$datos[titulo].'"></td></tr>';
}
echo '
</table><br><div align="center"><input type="submit" name="modificar" value="Guardar cambios" class="boton"></div>';
}
?>
</form></td>
</tr>
</table>
<br><a href="agregar.php">Agregar un programa</a>
<?
}else{
echo 'Tu no estas autentificado. No puedes entrar aqui!!<br><br><a href="index.php">Volver</a>';
}
?>
Como hago??