Anda di halaman 1dari 4

https://www.youtube.com/watch?

v=cYiqKW2FaUs

https://www.youtube.com/watch?v=AZpKqEQS4e4

https://www.youtube.com/watch?v=lZt6yAyVJCc

https://www.youtube.com/watch?v=9glSpdwygdk

https://es.wikihow.com/crear-una-base-de-datos-en-MySQL

https://www.youtube.com/watch?v=slJ4YthWAeU

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Cliver</title>
<link rel="shortcut icon" href=""/>
<link href="css/bootstrap.min.css" rel="stylesheet">
<style>
body{
background-image: url("");
}
</style>
</head>
<style type="text/css">
</style></head>
<body>
<header>
<center>
<h2><font color="black">ADMINISTRADOR DE PRODUCTOS </font></h2>
<fieldset style="width:810px; margin-top: 20px;top:2px;box-
shadow:0 0 100px 50 px yellow; box-shadow:0 0 300px blue; ALIGN="justify ">
<body>
<FIELDSET>

<LEGEND>************************************</LEGEND>
<div class="row">
<form action ="<?php
$_SERVER['PHP_SELF'];?>" method="POST">
<b>Buscar producto:
</b><input type="text" id="campo" size="60" name="campo" placeholder="Buscar
producto..."/>
<input type ="submit"
id="enviar" name="enviar" value="Buscar" class="btn btn-info"/>
<a data-toggle="modal"
class="btn btn-primary" data-target="#nuevo_producto">Agregar producto</a>
</form>
</div>
</FIELDSET>
</from>
</body>
</fieldset>

<table border='1' cellpadding='0' cellspacing='0' width='800' bgcolor='f6f6f6'


style="color.black">
<tr>
<td width='50' style="font-weight: bold ">ITEM</td>
<td width='200' style="font-weight: bold
"><center>PRODUCTO</center></td>
<td width='100' style="font-weight: bold "><center>PRECIO</center></td>
<td width='80' style="font-weight: bold "><center>FECHA</center></td>
<td width='100' style="font-weight: bold "><center>EDITAR</center></td>
</tr>

<?php
$mysqli= new mysqli("localhost","root","1234","sis_ventas");
if($mysqli->connect_error){
echo "Fallo al conectar a MySQL:(".$mysqli-connect_error.")".$mysqli-
>connect_error;
exit();
}
$consulta="SELECT *FROM producto";
if($resultado=$mysqli->query($consulta))
{
while ($fila=$resultado->fetch_row()) {
# code...
echo"<tr>";
echo
"<td>$fila[0]</td><td>$fila[1]</td><td>$fila[2]</td><td>$fila[3]</td>";
echo"<td>";
echo "<a data-toggle='modal' data-target='#editproducto' data-
id='".$fila[0]."' data-nom_prod='".$fila[1]."' data-precio='".$fila[2]."' data-
fecha='".$fila[3]."'class='btn btn-warning'><span class='glyphicon glyphicon-
pencil'></span>Editar</a>";
echo"<a class='btn btn-danger' href='elimina.php?id=".
$fila[0]."'><span class='glyphicon glyphicon-remove'></span>Eliminar</a>";
echo "</td>";
echo"</tr>";
}
$resultado->close();
}
$mysqli->close();
?>

</table>
</div>
<div class="modal" id="nuevo_producto" tabindex="-1" role="dialog" aria-
labellebdy="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">&times;</button>
<CENTER><h4>NUEVO REGISTRO DE PRODUCTOS</h4></CENTER>
</div>
<div class="modal-body">
<form action="insertar.php" method="GET">

NOMBRE DE PRODUCTO : <input type="text"


name="nom_prod" placeholder="INGRESE NOMBRE DEL PRODUCTO.." size="40" class="Form-
Input" Required/> &nbsp &nbsp &nbsp &nbsp &nbsp <br>
PRECIO S/.: <input type="text" name="precio"
placeholder="INGRESE PRECIO.." size="17" class="Form-Input"Required/> &nbsp &nbsp
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp <br>

FECHA: <input type="date" name="fecha"


placeholder="INGRESE FECHA..." size="15" class="Form-Input"Required/> &nbsp &nbsp
&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp <br><br>

<center><input type="submit" class="btn btn-success"


value="REGISTRAR"> &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp
<button type="button" class="btn btn-warning"
data-dismiss="modal">CANCELAR</button>
</center>
</form>
</div>
</div>
</div>
</div>

<div class="modal" id="editproducto" tabindex="-1" role="dialog" aria-


labellebdy="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-
hidden="true">&times;</button>
<h4>MODIFICAR LOS DE PRODUCTOS</h4>
</div>
<div class="modal-body">
<form action="actualiza.php" method="POST">

NOMBRE DE PRODUCTO : <input id="nom_prod" type="text" name="nom_prod"


size="40" class="Form-Input" Required/> &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp <br>

PRECIO S/.: <input id="precio" type="text" name="precio" size="20"


class="Form-Input"Required/> &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp
&nbsp &nbsp &nbsp <br>

FECHA: <input id="fecha" type="text" name="fecha" size="20" class="Form-


Input"Required/> &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp <br><br>

<center><input type="submit" class="btn btn-success"


value="REGISTRAR"> &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp
<button type="button" class="btn btn-warning"
data-dismiss="modal">CANCELAR</button></center>
</form>
</div>
</div>
</div>
</div>

</div>
<script src="js.jquery.min.js"></script>
<script src="js,bootstrap.min.js"></script>
<script>
$('#editproducto').on('show.bs.modal',function(event){
var button = $(event.relatedTarget)
var recipient0=button.data('Id')
var recipient1=button.data('Nom_Prod')
var recipient2=button.data('Precio')
var recipient3=button.data('Fecha')
var modal = $(this)
modal.find('.modal-body #Id').val(recipient0)
modal.find('.modal-body #Nom_Prod').val(recipient1)
modal.find('.modal-body #Precio').val(recipient2)
modal.find('.modal-body #Fecha').val(recipient3)

});
</script>
</body>
</fieldset>
</center>
</html>

Anda mungkin juga menyukai