SHARE
TWEET

Untitled

a guest Jun 16th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <form class="container" id="frmcarga" method="POST">
  2.   <div class="form-row">
  3.  <div class="form-group col-md-3">
  4.       <label for="">Vehículo</label>
  5.        <select  name="vehiculo" id="vehiculo" class="form-control">
  6.         <option value="">Seleccione...</option>
  7.         <?php
  8.             $query="SELECT  * FROM vehiculo";
  9.             $result=mysqli_query($con, $query) or die (mysqli_error());
  10.             while ($row=mysqli_fetch_array($result)){
  11.             echo '<option value="'.$row['vehiculo'].'">'.$row['vehiculo'].'</option>';
  12.           }
  13.         ?>
  14.       </select>
  15.      </div>
  16.  
  17.         <div class="form-group col-md-3">
  18.       <label for="">Odómetro</label>
  19.       <div class="input-group mb-3">
  20.       <div class="input-group-prepend">
  21.       <span class="input-group-text" id="basic-addon1">KM</span>
  22.     </div>
  23.       <input type="text" class="form-control numerico" name="kilometro" id="kilometro">
  24.     </div>
  25.      </div>
  26.  </div>
  27. </form>
  28.      
  29. <div class="form-group col-md-3">
  30.       <label for="">Kilometraje Total</label>
  31.    <?php
  32.    $query2="SELECT SUM(odometro) AS totalkilometros FROM carga_combustible WHERE vehiculo ='spark'";
  33.    $result=mysqli_query($con, $query2) or die (mysqli_error());
  34.    while ($row=mysqli_fetch_array($result)){
  35.     $row[0];
  36.  
  37.      ?>
  38.      <input type="text" class="form-control" name="totalkilometros" id="totalkilometros"
  39.       value="<?php echo$row[0]?>">
  40.      </div>    
  41. <?php
  42.  }
  43. mysqli_query($con,$query2) or die (mysqli_error());
  44. mysqli_close($con);
  45. ?>
  46.      
  47. $("#totalkilometros").change(function(){
  48.   var input = document.getElementById("totalkilometros");
  49.   var valor = input.value;
  50.     if( valor >= 1)
  51.     alert("Este vehículo necesita mantenimiento");
  52.     });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top