<?php if (!empty($_POST)) { require_once realpath(__DIR__ . '/../app/entity/EntityAccesorios.php'); $accesorio = new EntityAccesorios(); $accesorio->setEstado($_POST['estado']); $accesorio->setNombre($_POST['nombre']); $accesorio->save(); header('Location:../accesorios'); } ?> <!DOCTYPE html> <html> <head> <title>Nuevo Accesorio</title> </head> <body> <?php require_once realpath(__DIR__ . '/../form/formAccesorio.php'); ?> </body> </html>
<!DOCTYPE html> <html> <head> <title>Lista Accesorio</title> <link href="../css/main.css" rel="stylesheet" type="text/css"/> </head> <body> <h1>Registro de Accesorios</h1> <hr> <a href="nuevo.php">Nuevo Accesorio</a> <?php require_once realpath(__DIR__ . '/../app/entity/EntityAccesorios.php'); $listAccesorios = EntityAccesorios::getAllAccesorio(); ?> <hr> <table> <thead> <tr> <th>Nombre</th> <th>Estado</th> <th>Accion</th> </tr> </thead> <?php foreach ($listAccesorios as $index) { ?> <tr> <td><?php echo $index['accesorio_nombre']; ?> </td>
<?php require_once realpath(__DIR__ . '/../app/entity/EntityAccesorios.php'); $accesorio = new EntityAccesorios(); if (!empty($_POST)) { $accesorio->indentify($_POST['id']); $accesorio->setEstado($_POST['estado']); $accesorio->setNombre($_POST['nombre']); $accesorio->save(); header('Location:../accesorios'); } if (!empty($_GET)) { $accesorio->indentify($_GET['id']); $id = $accesorio->getId(); $estado = $accesorio->getEstado(); $nombre = $accesorio->getNombre(); } ?> <!DOCTYPE html> <html> <head> <title>Editar Accesorio</title> </head> <body> <?php require_once realpath(__DIR__ . '/../form/formAccesorio.php'); ?> </body> </html>
<?php require_once realpath(__DIR__ . '/app/entity/EntityAccesorios.php'); print_r(EntityAccesorios::getAllAccesorio());