addSupplier.php 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. require "connectionDb.php";
  3. if (isset($_POST['saveSupplier']) && isset($_POST['supplierName']) ) {
  4. $sname = $_POST['supplierName'];
  5. $db->exec("INSERT INTO supplier (type,created_at,updated_at,name) VALUES ('',datetime('now', 'localtime'),datetime('now', 'localtime'),'$sname');");
  6. echo '<script>window.location.href="suppliers.php"</script>';
  7. }
  8. ?>
  9. <style type="text/css">
  10. .addSupplierForm {
  11. display: none;
  12. }
  13. </style>
  14. <div class="container addSupplierForm" id="addSForm">
  15. <form class="form-horizontal" action="" method="post">
  16. <div class="form-group">
  17. <label class="control-label col-sm-2"> Name </label>
  18. <div class="col-sm-10">
  19. <input type="text" name="supplierName">
  20. </div>
  21. </div>
  22. <div class="form-group">
  23. <div class="col-sm-offset-2 col-sm-10">
  24. <input type="submit" name="saveSupplier" value="Save">
  25. <input type="button" value="Cancel" onclick="document.getElementById('addSForm').style.display = 'none';">
  26. </div>
  27. </div>
  28. </form>
  29. </div>