<?php
$con = mysqli_connect('localhost','root','');
mysqli_select_db('kenworth',$con);
$nombre = $_POST['nombre'];
$entrega = $_POST['entrega'];
$devolucion = $_POST['devolucion'];
$concepto = $_POST['concepto'];
$cantidad = $_POST['cantidad'];
$descripcion = $_POST['descripcion'];
$req = (strlen($nombre)*strlen($entrega)*strlen($devolucion)*strlen($concepto)*strlen($cantidad)*strlen($descripcion)) or die("No se han llenado los campos");
mysqli_query($con, "INSERT INTO Prestamos VALUES ('$nombre','$entrega','$devolucion','$concepto','$cantidad','$descripcion')");
?>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Solicitud de prestamos</title>
<meta name="viewport" content="width=device-width,initial-scale=1maximum-scale=1user-scalable=no">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="HandheldFriendly" content="True">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="static/css/materialize.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">
<link rel="stylesheet" href="static/css/fakeLoader.css">
<link rel="stylesheet" href="static/css/style.css">
<link href="https://fonts.googleapis.com/css?family=Tangerine" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Spinnaker" rel="stylesheet">
<link rel="stylesheet" href="static/css/fakeLoader.css">
</head>
<body style="background:#424242;">
<div class="input-field col s12 center">
<img src="static/img/logo.png" alt="" class="responsive-img" width="700px">
<h2 class="black-text">Prestamos de equipo de cómputo</h2>
</div>
<div class="row">
<div class="input-field col s5">
<label for="first_name" >Nombre/Destino</label>
<input type="text" name="nombre" class="validate">
</div>
<div class="input-field col s4">
<input type="text" name="entrega" class="datepicker">
<label for="first_name">Entrega de prestamo</label>
</div>
<div class="input-field col s3">
<input type="text" name="devolucion" class="datepicker">
<label for="first_name">Devolución del prestamo</label>
</div>
</div>
<div class="row">
<label>Seleciona un concepto</label>
<select name="concepto" class="input-field col s12">
<option value="" disabled selected>Elije tu opción</option>
<option value="1">Equipo de computo</option>
<option value="2">Material diverso u otro</option>
</select>
</div>
<div class="row">
<div class="input-field col s6">
<label for="first_name" >Cantidad</label>
<input name="cantidad" type="number">
</div>
<div class="input-field col s6">
<label for="Des">Descripción del equipo</label>
<input name="descripcion" type="text">
</div>
</div>
<div class="row">
<input type="submit" value="Guardar" style="background-color:#607d8b;">
<input type="reset" style="background-color:#607d8b;" id="guardar" value="Limpiar">
</div>
<table id="tabla_prestamo" border="1">
<tr>
<td>Nombre</td>
<td>Entrega del prestamo</td>
<td>Devoluación del prestamo</td>
<td>Concepto</td>
<td>Cantidad</td>
<td>Descripción del equipo</td>
<td>Detalles</td>
</tr>
<?php
$sql="SELECT * FROM prestamos";
$result=mysqli_query($link,$sql);
while ($mostrar=mysqli_fetch_array($result)) {
# code...
?>
<tr>
<td><?php echo $mostrar['Destino']?></td>
<td><?php echo $mostrar['Fecha_Entrega']?></td>
<td><?php echo $mostrar['fecha_Devolucion']?></td>
<td><?php echo $mostrar['Concepto']?></td>
<td><?php echo $mostrar['Cantidad']?></td>
<td><?php echo $mostrar['Descripción']?></td>
<td><?php echo $mostrar['Detalles']?><a href="#pruebamodal" class="waves-effect waves-light btn modal-trigger">Detalles</a></td>
</tr>
</table>
<div id="pruebamodal" class="modal">
<h4>Ejemplo de modal</h4>
<p>A ver si funciona por que no me abre la modal</p>
<p> no se por que</p>
</div>
</div>
<?php
}
?>
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
overflow: scroll;
overflow: auto;
}
td, th {
border: 1px solid #000000;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #757575;
}
</style>
<script type="text/javascript" src="cordova.js"></script>
<script src="static/js/jquery-3.1.1.js"></script>
<script type="text/javascript" src="static/js/materialize-01.js"></script>
<script type="text/javascript" src="reg.php" ></script>
<script type="text/javascript" src="js/index.js"></script>
<script src="./js/bootstrap.min.js"></script>
<script src="js/jquery.js"></script>
<script src="js/materialize.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('select').material_select();
});
</script>
<script type="text/javascript">
$('.datepicker').pickadate({
selectMonths: true, // Creates a dropdown to control month
selectYears: 15, // Creates a dropdown of 15 years to control year,
today: 'Today',
clear: 'Clear',
close: 'Ok',
closeOnSelect: false // Close upon selecting a date,
});
</script>
<script type="text/javascript">
$(document).ready(function(){
$('#guardar').click(function(){
var nombre = document.getElementById("nombre").value;
var entrega = document.getElementById("entrega").value;
var devolucion = document.getElementById("devolucion").value;
var concepto = document.getElementById("concepto").value;
var cantidad = document.getElementById("cantidad").value;
var descripcion = document.getElementById("descripcion").value;
var i = 1;
var fila = '<tr id="row'+ i + '"><td>' + nombre + '</td><td>' + entrega + '</td><td>' + devolucion + '</td><td>' + concepto + '</td><td>' + cantidad + '</td><td>' + descripcion + '</td><td><button type="button" name="detalle" id"' + i + '" class="btn waves-effect waves-light btn_detalle" style="width:80px">Detalle</button></td></tr>';
i++;
$('#tabla_prestamo tr:first').after(fila);
var nfilas = $("#tabla_prestamo tr").length;
document.getElementById("descripcion").value = "";
document.getElementById("cantidad").value = "";
document.getElementById("concepto").value = "";
document.getElementById("devolucion").value = "";
document.getElementById("entrega").value = "";
document.getElementById("nombre").value = "";
document.getElementById("nombre").focus();
});
$(document).on ('click', 'btn_detalle', function(){
var buton_id = $(this).attr("id");
$('#row' + buton_id + '').
document.addEventListener('DOMContentLoaded', function() {
var elems = document.querySelectorAll('.modal');
var instances = M.Modal.init(elems, options);
});
$(document).ready(function(){
$('.modal').modal();
});
});
});
</script>
</body>
</html>
-
Hola, mucho gusto, es un placer tenerte como parte de esta comunidad, te invito a que leas el centro de ayuda de como preguntar, Como preguntar, por otro lado revisa una de mis preguntas sobre modales, la cual te puede servir Como mostrar modal– M4uriXDel 25 feb. 2019 a las 18:27
-
lo de la modal de bootstrap te sugiero que revises como debes definir o cargar tus librerias de Bootstrap: getbootstrap.com/docs/4.3/getting-started/introduction/…– Diego Avilael 25 feb. 2019 a las 19:45
-
1probe tu codigo y la modal ni siquiera se construye se da errores, por lo cual debes ver el orden en que debes cargar– Diego Avilael 25 feb. 2019 a las 19:46
Añade un comentario
|