addCustomer.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. require "connectionDb.php";
  3. if (isset($_POST['addCustomer']) && isset($_POST['addusername']) ) {
  4. echo $username = $_POST['addusername'];
  5. $creditSale = ($_POST['addcreditSale']=='on') ? 1 : 0 ;
  6. $db->exec("INSERT INTO customer (type,created_at,updated_at,name,credit_sale) VALUES ('',strftime('%Y-%m-%d %H:%M:%f000000+06:30', 'now', 'localtime'),strftime('%Y-%m-%d %H:%M:%f000000+06:30', 'now', 'localtime'),'$username','$creditSale');");
  7. //echo '<script>window.location.href="customers.php"</script>';
  8. }else {
  9. // $_SESSION['error'] = "En"
  10. }
  11. ?>
  12. <style type="text/css">
  13. .addForm {
  14. display: none;
  15. }
  16. form.form-horizontal.formCustomer.modal-content.animate {
  17. width: 400px;
  18. height: 280px;
  19. margin-left: -15px;
  20. background-color: #dfe3e6;
  21. }
  22. div#addForm {
  23. width: 400px;
  24. height: 280px;
  25. border-radius: 0.5em;
  26. margin-top: 100px;
  27. }
  28. .form-group.row1{
  29. height:20px;
  30. margin-left: 150px;
  31. margin-top: 20px;
  32. margin-bottom: 30px;
  33. }
  34. .form-group.row1 label{
  35. color: #610e14;
  36. font-family:-webkit-pictograph;
  37. font-size: 20px;
  38. }
  39. .addForm span{
  40. color:red;
  41. margin-right: 5px;
  42. }
  43. .form-group.row2{
  44. margin-left: 50px;
  45. }
  46. .form-group.row2 label{
  47. color: #610e14;
  48. font-family:-webkit-pictograph;
  49. }
  50. .form-group.row2 input[type='text']{
  51. border:1px solid grey;
  52. border-radius: 0.5em;
  53. height: 30px;
  54. }
  55. .form-group.row3{
  56. margin-top: 30px;
  57. }
  58. .form-group.row3 label{
  59. color: #610e14;
  60. margin-left: 20px;
  61. font-family:-webkit-pictograph;
  62. }
  63. .form-group.row3 input[type='checkbox']{
  64. width: 20px;
  65. height: 20px;
  66. }
  67. input.btn.btn-default.addCustomer {
  68. background: radial-gradient(#0da3bb, #04161fc2);
  69. color: #fff;
  70. font-family: -webkit-pictograph;
  71. font-size: 20px;
  72. margin-top: 10px;
  73. margin-left: 90px;
  74. width: 120px;
  75. }
  76. </style>
  77. <div class="container addForm modal" id="addForm">
  78. <form class="form-horizontal modal-content animate formCustomer" action="#" method="post">
  79. <span onclick="document.getElementById('addForm').style.display='none'" class="close" title="Close PopUp">&times;</span>
  80. <div class="form-group row1">
  81. <label>New Customer</label>
  82. </div>
  83. <div class="form-group row2" >
  84. <label class="control-label col-md-2"> Name:&nbsp;&nbsp;&nbsp;&nbsp; </label>
  85. <div class="col-md-3">
  86. <input type="text" name="addusername" required="true">
  87. </div>
  88. </div>
  89. <div class="form-group row3">
  90. <div class="col-md-1"></div>
  91. <label class="control-label col-md-3"> Credit Sale:</label>
  92. <div class="col-md-3">
  93. <input type="checkbox" name="addcreditSale">
  94. </div>
  95. </div>
  96. <div class="form-group">
  97. <div class="col-sm-offset-2 col-sm-10">
  98. <input type="submit" class="btn btn-default addCustomer" value="Save" name="addCustomer">
  99. </div>
  100. </div>
  101. </form>
  102. </div>