<table id="grid-basic" class="table table-condensed table-hover table-striped" data-selection="true" data-multi-select="true" data-row-select="true"> <thead> <tr> <th data-column-id="id" data-align="left" data-width="40px" data-type="numeric" data-order="asc">ID</th> <th data-column-id="marca" data-width="25%" data-align="left" data-header-align="center">marca</th> <th data-column-id="modelo" data-width="25%">Modelo</th> <th data-column-id="color" data-width="20%">Color</th> <th data-column-id="placa" data-width="100px">Placa</th> <th data-column-id="estado" data-width="100px">Estado</th> <th data-column-id="actions" align="center" data-formatter="actions" data-width="100px">Acciones</th> </tr> </thead> <tbody> <?php echo verAutomovil(); ?> </tbody> </table> </div> </div> </div> </div> <a type="button" href="addAutomovil.php" class="btn btn-primary pull-right"><i class="fa fa-plus fa-fw"></i> Agregar</a> <!-- /.row --> </div>
<?php session_start(); require_once "install.php"; /* REQUEST = $_POST $_GET */ if (!empty($_REQUEST['action'])) { $accion = $_REQUEST['action']; if ($accion == 'crear') { crearAutomovil(); } else { if ($accion == 'ver') { verAutomovil(); } else { if ($accion == 'update') { updateAutomovil(); } else { if ($accion == 'delete') { deleteAutomovil(); } } } } } function crearAutomovil() { /* Proteccion de Datos */ $params = array(':marca' => $_POST['marca'], ':modelo' => $_POST['modelo'], ':color' => $_POST['color'], ':placa' => $_POST['placa'], ':estado' => $_POST['estado']); /* Preparamos el query apartir del array $params*/ $query = 'INSERT INTO Automovil (Marca,Modelo,Color,Placa,Estado) VALUES