 <script>
$('#update_form').on("submit", function(event){  
  event.preventDefault();  
  if($('#enomor_perkarapa').val() == "")  
  {  
   alert("Mohon Isi Nomor_Perkara");  
  }  
  else if($('#ejenis_perkarapa').val() == '')  
  {  
   alert("Mohon Isi Jenis Perkara");  
  } 
   else if($('#enama_pembanding').val() == '')  
  {  
   alert("Mohon Isi Nama Pihak Pembanding");  
  } 
   else if($('#enama_terbanding').val() == '')  
  {  
   alert("Mohon Isi Nama Pihak Terbanding");  
  }    
 
  else  
  {  
   $.ajax({  
    url:"kegiatan/update.php",  
    method:"POST",  
    data:$('#update_form').serialize(),  
    beforeSend:function(){  
     $('#update').val("Updating");  
    },  
    success:function(data){  
     $('#update_form')[0].reset();  
     $('#editModal').modal('hide');  
     $('#employee_table').html(data);  
     location.reload();
    }  
   });  
  }  
 });
</script>
<?php 
if(isset($_POST["employee_id"]))
{
 $output = '';
 include 'config.php';
 $query = "SELECT * FROM data_kegiatan WHERE id = '".$_POST["employee_id"]."'";
 $result = mysqli_query($koneksi, $query);
	$row = mysqli_fetch_array($result);
     $output .= '
         <form method="post" id="update_form">
         <input type="hidden" name="id" id="id" value="'.$_POST["employee_id"].'" class="form-control" />
         <label style="font-family:cambria; font-size:12px">Tanggal Kegiatan</label>
                <input type="date" name="tgl" id="tgl" class="form-control form-control-sm text-sm" style="font-size:12px" value="'.$row['tgl_kegiatan'].'"/> 
                <label style="font-family:cambria; font-size:12px">Nama Kegiatan</label>
                <input type="text" name="nama" id="nama" class="form-control form-control-sm text-sm" style="font-size:12px" value="'.$row['nama_kegiatan'].'"/> 
                <label style="font-family:cambria; font-size:12px">Link Absen Kegiatan</label>
                <input type="text" name="absen" id="absen" value="'.$row['link_absen'].'" class="form-control form-control-sm text-sm" style="font-size:12px"/> 
                <label style="font-family:cambria; font-size:12px">Status</label>
                <select id="status" name="status" class="form-select" style="font-size:12px">
                <option value="'.$row['status'].'" disabled selected>'.$row['status'].'</option>
                            <option value="Aktif">Aktif	</option>
                            <option value="Tidak Aktif">Tidak Aktif	</option>
                </select>
	 <br />
     <input type="submit" name="update" id="update" value="Simpan" class="btn btn-success" />

    </form>
     ';
    echo $output;
}
?>

<?php
function bln_indo($tanggal){
	$bulan = array (
		1 =>   'Januari',
		'Februari',
		'Maret',
		'April',
		'Mei',
		'Juni',
		'Juli',
		'Agustus',
		'September',
		'Oktober',
		'November',
		'Desember'
	);
	$pecahkan = explode('-', $tanggal);
	
	// variabel pecahkan 0 = tanggal
	// variabel pecahkan 1 = bulan
	// variabel pecahkan 2 = tahun
 
    return $pecahkan[2] . ' ' . $bulan[ (int)$pecahkan[1] ] . ' ' . $pecahkan[0];
}
