editVehicle.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. require "connectionDb.php";
  3. if (isset($_POST['saveNumber']) && isset($_POST['id']) && isset($_POST['number'])) {
  4. $id = $_POST['id'];
  5. $number = $_POST['number'];
  6. $sql ="UPDATE vehicle SET number='$number' WHERE id='$id'";
  7. $db->exec($sql);
  8. echo '<script>window.location.href="index.php"</script>';
  9. }
  10. ?>
  11. <style type="text/css">
  12. .editVehicleForm {
  13. display: none;
  14. }
  15. </style>
  16. <div class="container editVehicleForm" id="editVForm">
  17. <form class="form-horizontal" action="" method="post">
  18. <input type="text" name="id" id="vehicle_id" hidden="hidden">
  19. <div class="form-group">
  20. <label class="control-label col-sm-2"> Number </label>
  21. <div class="col-sm-10">
  22. <input type="text" name="number" id="number">
  23. </div>
  24. </div>
  25. <div class="form-group">
  26. <div class="col-sm-offset-2 col-sm-10">
  27. <input type="submit" name="saveNumber" value="Save">
  28. <input type="button" value="Cancel" onclick="document.getElementById('editVForm').style.display = 'none';">
  29. </div>
  30. </div>
  31. </form>
  32. </div>