Guest User

Untitled

a guest
Dec 12th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. <script type="text/javascript">
  2. $(document).ready(function(){
  3. $("#codigo").change(function(){
  4. $.get("admin/actions/checkbox_mantenimiento.php","codigo="+$("#codigo").val(), function(data){
  5. $("#tipos_mant").html(data);
  6. console.log(data);
  7. });
  8. });
  9. });
  10. </script>
  11.  
  12. <?php
  13.  
  14. include("config.php");
  15.  
  16. if(isset($_GET['codigo']))
  17. {
  18. $codigoequipo=$_GET['codigo'];
  19.  
  20. if($codigoequipo=="") {
  21. echo "Ningún equipo seleccionado.";
  22. }
  23.  
  24. else {
  25. $consulequipo = "SELECT * FROM maquinarias WHERE serialequipo = '$codigoequipo'";
  26. $consultipos = "SELECT * FROM mantenimiento WHERE codigo = '$codigoequipo'";
  27.  
  28. $equipo = $bd->consulta($consulequipo);
  29. $tipos = $bd->consulta($consultipos);
  30.  
  31. if ($rowtipos = $tipos->fetch_assoc() && $rowequipo = $equipo->fetch_assoc()) {
  32. $cantidadcb = $rowtipos['nro_tipos'];
  33.  
  34. $checkboxes = while ($trigger < $cantidadcb) {
  35. echo "
  36. <tr>
  37. <td width="50%">
  38. <input class="form-control" type="checkbox" value="".$rowtipos['tipo'.$trigger]."required name="op_".$trigger."">
  39. </td>
  40. </tr>";
  41. $trigger++;
  42. }
  43.  
  44. echo "
  45. <form role="form" action="?admin=mperiod&crearperiod=crearperiod" method="post" enctype="multipart/form-data">
  46. <thead>
  47. <tr>
  48. <th>Código</th>
  49. </tr>
  50. </thead>
  51.  
  52. <tbody>
  53. <tr colspan="2" width="50%">
  54. <td>
  55. <input type="text" class+"form-control" value="".$rowequipo['serialequipo']."" name="codigo" readonly required>
  56. </td>
  57. </tr>
  58. <tbody>
  59.  
  60. <thead>
  61. <tr>
  62. <th>Tipos de Mantenimiento Asociados</th>
  63. <tr>
  64. <thead>
  65.  
  66. <tbody>
  67. ".$checkboxes."
  68. <tbody>
  69. <tr>
  70. <td width="100%" colspan="2"><center>
  71. <button type="submit" class="btn btn-primary btn-lg" name="lugarguardar" value="Guardar">Registrar</button></center>
  72. </td>
  73. </tr>
  74. </tbody>
  75. </form>";
  76. }
  77. }
  78. }
  79. ?>
Add Comment
Please, Sign In to add comment