<?php 
  require "connectionDb.php";
    if (isset($_POST['saveSupplier']) && isset($_POST['supplierName']) ) {
   
     $sname = $_POST['supplierName'];

    $db->exec("INSERT INTO supplier (type,created_at,updated_at,name) VALUES ('',datetime('now', 'localtime'),datetime('now', 'localtime'),'$sname');");

    echo '<script>window.location.href="index.php"</script>';
    }
 ?>
<style type="text/css">
  .addSupplierForm {
    display: none;
  }
</style>
<div class="container addSupplierForm" id="addSForm">
<form class="form-horizontal" action="" method="post">
    <div class="form-group">
     <label class="control-label col-sm-2"> Name </label>
    <div class="col-sm-10"> 
    <input type="text" name="supplierName">
    </div>
   </div>

    <div class="form-group">
      <div class="col-sm-offset-2 col-sm-10"> 
    <input type="submit" name="saveSupplier" value="Save">
    <input type="button" value="Cancel" onclick="document.getElementById('addSForm').style.display = 'none';">
    </div>
  </div>
  </form>
</div>