addVehicle.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. require "connectionDb.php";
  3. if (isset($_POST['saveNumber']) && isset($_POST['number']) ) {
  4. $number = $_POST['number'];
  5. $cid = $_COOKIE['customerId'];
  6. $db->exec("INSERT INTO vehicle (type,created_at,updated_at,customer_id,number) VALUES ('',strftime('%Y-%m-%d %H:%M:%f000000+06:30', 'now', 'localtime'),strftime('%Y-%m-%d %H:%M:%f000000+06:30', 'now', 'localtime'),'$cid','$number');");
  7. echo '<script>window.location.href="customers.php"</script>';
  8. }
  9. ?>
  10. <style type="text/css">
  11. .addVehicleForm {
  12. display: none;
  13. }
  14. </style>
  15. <div class="container addVehicleForm" id="addVForm">
  16. <form class="form-horizontal" action="" method="post">
  17. <div class="form-group">
  18. <label class="control-label col-sm-2"> Number </label>
  19. <div class="col-sm-10">
  20. <input type="text" name="number">
  21. </div>
  22. </div>
  23. <div class="form-group">
  24. <div class="col-sm-offset-2 col-sm-10">
  25. <input type="submit" name="saveNumber" value="Save">
  26. <input type="button" value="Cancel" onclick="document.getElementById('addVForm').style.display = 'none';">
  27. </div>
  28. </div>
  29. </form>
  30. </div>