Edit.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?php
  2. require "connectionDb.php";
  3. if (isset($_POST['edit']) && isset($_POST['id']) && isset($_POST['username']) ) {
  4. $id = $_POST['id'];
  5. $username = $_POST['username'];
  6. $creditSale = $_POST['creditSale'];
  7. //$vehicle_id = $_POST['vehicle_id'];
  8. //$number = $_POST['number'];
  9. $sql ="UPDATE customer SET name='$username',credit_sale='$creditSale' WHERE id='$id'";
  10. //$sql2 ="UPDATE vehicle SET number='$number' WHERE id='$vehicle_id'";
  11. $db->exec($sql);
  12. //$db->exec($sql2);
  13. echo '<script>window.location.href="customers.php"</script>';
  14. }
  15. ?>
  16. <style type="text/css">
  17. .editForm {
  18. display: none;
  19. }
  20. form.form-horizontal.editCustomer.modal-content.animate {
  21. width: 400px;
  22. height: 280px;
  23. margin-left: -15px;
  24. background-color: #dfe3e6;
  25. }
  26. div#editForm {
  27. width: 400px;
  28. height: 280px;
  29. border-radius: 0.5em;
  30. margin-top: 100px;
  31. }
  32. .form-group.rowRadio {
  33. margin-left: 28px;
  34. color: #610e14;
  35. }
  36. .form-group.erow2{
  37. margin-left: 50px;
  38. }
  39. .form-group.erow2 input[type='text']{
  40. border:1px solid grey;
  41. border-radius: 0.5em;
  42. height: 35px;
  43. width: 250px;
  44. }
  45. .form-group.erow2 label{
  46. color: #610e14;
  47. font-family:-webkit-pictograph;
  48. }
  49. .editForm span{
  50. color:red;
  51. margin-right: 5px;
  52. }
  53. input.btn.btn-default.editSave {
  54. background: radial-gradient(#0da3bb, #04161fc2);
  55. color: #610e14;
  56. font-family:-webkit-pictograph;
  57. font-size: 18px;
  58. margin-right: 20px;
  59. width: 70px;
  60. }
  61. input.btn.btn-default.editCancel {
  62. background: radial-gradient(#b71515eb, #ef0b0bdb);
  63. color: #fff;
  64. font-family:-webkit-pictograph;
  65. font-size:18px;
  66. width: 73px;
  67. }
  68. .form-group.editBtn {
  69. margin-left: 30px;
  70. margin-top: 45px;
  71. }
  72. </style>
  73. <div class="container editForm modal" id="editForm">
  74. <form class="form-horizontal modal-content animate editCustomer" action="" method="post">
  75. <span onclick="document.getElementById('editForm').style.display='none'" class="close" title="Close PopUp">&times;</span>
  76. <div class="form-group row1">
  77. <label>Edit Customer</label>
  78. </div>
  79. <input type="number" name="id" id="id" hidden="hidden">
  80. <div class="form-group erow2">
  81. <label class="control-label col-sm-2"> Name: </label>
  82. <div class="col-sm-10">
  83. <input id="username" type="text" name="username">
  84. </div>
  85. </div>
  86. <div class="form-group rowRadio">
  87. <!-- <div class="col-md-1"></div> -->
  88. <label class="control-label col-md-4">Credit Sale:</label>
  89. <div class="col-md-8">
  90. <!-- <input id="creditSaleOn" type="checkbox" name="creditSale">
  91. <input id="creditSaleOff" type="checkbox" name="creditSale"> -->
  92. <input id="creditSaleOn" type="radio" name="creditSale" value="1"> Yes<br>
  93. <input id="creditSaleOff" type="radio" name="creditSale" value="0"> No<br>
  94. </div>
  95. </div>
  96. <!-- <input type="number" name="vehicle_id" id="vehicle_id" hidden="hidden">
  97. <div class="form-group">
  98. <label class="control-label col-sm-2"> Number</label>
  99. <div class="col-sm-10">
  100. <input id="number" type="text" name="number">
  101. </div>
  102. </div> -->
  103. <div class="form-group editBtn">
  104. <div class="col-sm-offset-2 col-sm-10">
  105. <input type="submit" name="edit" value="Save" class="btn btn-default editSave">
  106. <input type="button" class="btn btn-default editCancel" value="Cancel" onclick="document.getElementById('editForm').style.display = 'none';">
  107. </div>
  108. </div>
  109. </form>
  110. </div>