-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheditar-entrada.php
55 lines (45 loc) · 2.02 KB
/
editar-entrada.php
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php require_once 'includes/redireccion.php'; ?>
<?php require_once 'includes/conexion.php' ?>
<?php require_once 'includes/helpers.php' ?>
<?php
$entrada_actual = conseguirEntrada($db, $_GET['id']);
if(!isset($entrada_actual['id'])){
header("Location: index.php");
}
?>
<?php require_once 'includes/cabecera.php' ?>
<?php require_once 'includes/lateral.php' ?>
<!-- CAJA PRINCIPAL -->
<div id="principal">
<h1>Editar Entrada</h1>
<p>
Edita tu entrada: <?=$entrada_actual['titulo']?>
</p>
<form action="guardar-entrada.php?editar=<?=$entrada_actual['id']?>" method="POST">
<label for="titulo">Titulo</label>
<input type="text" name="titulo" value="<?=$entrada_actual['titulo']?>"/>
<?php echo isset($_SESSION['errores_entrada']) ? mostrarError($_SESSION['errores_entrada'], 'titulo') : '' ; ?>
<label for="descripcion">Descripcion</label>
<textarea name="descripcion"> <?=$entrada_actual['descripcion']?></textarea>
<?php echo isset($_SESSION['errores_entrada']) ? mostrarError($_SESSION['errores_entrada'], 'descripcion') : '' ; ?>
<label for="categoria">Categoria</label>
<select name="categoria">
<?php $categorias = conseguirCategorias($db);
if(!empty($categorias)):
while($categoria = mysqli_fetch_assoc($categorias)):
?>
<option value="<?=$categoria['id']?>"
<?=($categoria['id'] == $entrada_actual['categoria_id']) ? 'selected="selected"' : '' ?> >
<?=$categoria['nombre']?>
</option>
<?php
endwhile;
endif;
?>
</select>
<?php echo isset($_SESSION['errores_entrada']) ? mostrarError($_SESSION['errores_entrada'], 'categoria') : '' ; ?>
<input type="submit" value="Guardar" />
</form>
<?php borrarErrores(); ?>
</div> <!-- Fin PRINCIPAL -->
<?php require_once 'includes/pie.php'; ?>