<?php 
  require "connectionDb.php";
    if (isset($_POST['addCustomer']) && isset($_POST['addusername']) ) {
   
     $username = $_POST['addusername'];
     echo $creditSale = ($_POST['addcreditSale']=='on') ? 1 : 0 ;

    $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');");

    echo '<script>window.location.href="customers.php"</script>';
    }
 ?>
 <style type="text/css">
   .addForm {
    display: none;
   }
 </style>
<div class="container addForm" id="addForm">
    <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="addusername">
    </div>
   </div>

    <div class="form-group">
     <label class="control-label col-sm-2"> Credit Sale</label>
      <div class="col-sm-10"> 
      <input type="checkbox" name="addcreditSale">
   </div>
  </div>

  <div class="form-group">        
      <div class="col-sm-offset-2 col-sm-10">
        <input type="submit" class="btn btn-default" value="Submit" name="addCustomer">
        </div>
    </div>
    </form>
</div>