Created
March 13, 2018 17:25
-
-
Save parzibyte/a9eaa09fc9dae3e68cc04a81a5d2871a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(!isset($_GET["id"])) exit(); | |
$id = $_GET["id"]; | |
include_once "base_de_datos.php"; | |
$sentencia = $base_de_datos->prepare("SELECT * FROM productos WHERE id = ?;"); | |
$sentencia->execute([$id]); | |
$producto = $sentencia->fetch(PDO::FETCH_OBJ); | |
if($producto === FALSE){ | |
echo "¡No existe algún producto con ese ID!"; | |
exit(); | |
} | |
?> | |
<?php include_once "encabezado.php" ?> | |
<div class="col-xs-12"> | |
<h1>Editar producto con el ID <?php echo $producto->id; ?></h1> | |
<form method="post" action="guardarDatosEditados.php"> | |
<input type="hidden" name="id" value="<?php echo $producto->id; ?>"> | |
<label for="codigo">Código de barras:</label> | |
<input value="<?php echo $producto->codigo ?>" class="form-control" name="codigo" required type="text" id="codigo" placeholder="Escribe el código"> | |
<label for="descripcion">Descripción:</label> | |
<textarea required id="descripcion" name="descripcion" cols="30" rows="5" class="form-control"><?php echo $producto->descripcion ?></textarea> | |
<label for="precioVenta">Precio de venta:</label> | |
<input value="<?php echo $producto->precioVenta ?>" class="form-control" name="precioVenta" required type="number" id="precioVenta" placeholder="Precio de venta"> | |
<label for="precioCompra">Precio de compra:</label> | |
<input value="<?php echo $producto->precioCompra ?>" class="form-control" name="precioCompra" required type="number" id="precioCompra" placeholder="Precio de compra"> | |
<label for="existencia">Existencia:</label> | |
<input value="<?php echo $producto->existencia ?>" class="form-control" name="existencia" required type="number" id="existencia" placeholder="Cantidad o existencia"> | |
<br><br><input class="btn btn-info" type="submit" value="Guardar"> | |
<a class="btn btn-warning" href="./listar.php">Cancelar</a> | |
</form> | |
</div> | |
<?php include_once "pie.php" ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment