<!-- basic form start -->
<div class="col-12 mt-5">
  <div class="card">
    <div class="card-body">
      <h4 class="header-title">Tambah Data Pembayaran</h4>
      <form method="post" enctype="multipart/form-data">
        <div class="form-group">
          <?php
# Opsi Level Login
          $arrLevel = array("Kasir","Admin");

          if($_GET) {
            if(isset($_POST['btnSave'])){
              $message = array();
              if (trim($_POST['txtkode'])=="") {
                $message[] = "Kode Pembayaran tidak boleh kosong !";    
              }
              if (trim($_POST['txtketerangan'])=="") {
                $message[] = "Keterangan tidak boleh kosong !";   
              }


    # Baca Variabel Form
              $txtketerangan = $_POST['txtketerangan'];
              $txtketerangan = str_replace("'","&acute;",$txtketerangan);

              $txtkode = $_POST['txtkode'];
              $txtkode= str_replace("'","&acute;",$txtkode);





    # Jika jumlah error message tidak ada
              if(count($message)==0){     
                $sqlSave="INSERT INTO bulan SET kode='$txtkode', keterangan='$txtketerangan'";
                $qrySave=mysql_query($sqlSave, $koneksidb) or die ("Gagal query".mysql_error());
                if($qrySave){
                  echo "<meta http-equiv='refresh' content='0; url=?page=Data-Pembayaran&Act=Sucsses'>";
                }
              } 

    # JIKA ADA PESAN ERROR DARI VALIDASI
    // (Form Kosong, atau Duplikat ada), Ditampilkan lewat kode ini
              if (! count($message)==0 ){
                echo "<div class='mssgBox'>";
                // echo "<img src='images/attention.png' class='imgBox'> <hr>";
                $Num=0;
                foreach ($message as $indeks=>$pesan_tampil) { 
                  $Num++;
                  echo "<div class='alert alert-danger alert-dismissible fade show' role='alert'>";
                  echo "&nbsp;&nbsp; $Num. $pesan_tampil<br>";
                  echo "<button type='button' class='close' data-dismiss='alert' aria-label='Close'>";
                  echo "<span class='fa fa-times'></span>
                  </button>
                  </div>";  
                } 
                echo "</div>"; 
              }
  } // Penutup POST
  
  # MASUKKAN DATA KE VARIABEL
  $datanis= isset($_POST['txtkode']) ? $_POST['txtkode'] : '';
  $datakdkelas= isset($_POST['txtketerangan']) ? $_POST['txtketerangan'] : '';
  
  
} // Penutup GET
?>
</div>
<div class="form-row">
  <div class="col-md-4 mb-3">
    <label for=""><b>Kode Pembayaran</b></label>
    <input type="text" class="form-control" name="txtkode" value="" placeholder="Masukan Kode Pembayaran">
  </div>
  <div class="col-md-8 mb-3">
   <label for=""><b>Keterangan</b></label>
   <input type="text" class="form-control" name="txtketerangan" value="" placeholder="Masukan Keterangan Pembayaran">
 </div>
</div>
<button type="submit" class="btn btn-primary col-12" name="btnSave"><b>Simpan Data</b></button>
</form>
</div>
</div>
</div>
<!-- basic form end -->