addCustomer.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. require "connectionDb.php";
  3. if (isset($_POST['addCustomer']) && isset($_POST['addusername']) ) {
  4. $username = $_POST['addusername'];
  5. echo $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. }
  9. ?>
  10. <style type="text/css">
  11. .addForm {
  12. display: none;
  13. }
  14. </style>
  15. <div class="container addForm" id="addForm">
  16. <form class="form-horizontal" action="" method="post">
  17. <div class="form-group">
  18. <label class="control-label col-sm-2"> Name </label>
  19. <div class="col-sm-10">
  20. <input type="text" name="addusername">
  21. </div>
  22. </div>
  23. <div class="form-group">
  24. <label class="control-label col-sm-2"> Credit Sale</label>
  25. <div class="col-sm-10">
  26. <input type="checkbox" name="addcreditSale">
  27. </div>
  28. </div>
  29. <div class="form-group">
  30. <div class="col-sm-offset-2 col-sm-10">
  31. <input type="submit" class="btn btn-default" value="Submit" name="addCustomer">
  32. </div>
  33. </div>
  34. </form>
  35. </div>