Daftar dan Belajar Sekarang!

File tidak mau update dan tidak masuk ke database

foto melisya
1 Kontribusi 0 Coto
2 bulan yang lalu
Permisi master, saya mau tanya. Kemarin saya iseng2 belajar ngembangin website dari website yang sudah dibuat oleh orang lain dan web tersebut dibuat dengan bootstrap, setelah saya edit dan ketika saya mau masukin data pegawai lewat tampilan layout web, data yang sudah saya masukkan tidak mau update di tampilan layout data pegawai dan data tidak masuk ke database. Mohon koreksinya master Tambah dan edit data
<?php
include "koneksi.php";

$aksi="module/pegawai/pegawai_aksi.php";

switch($_GET[aksi]){
default:
?>
<!----- ------------------------- MENAMPILKAN DATA MASTER pegawai ------------------------- ----->			
<h3 class="box-title margin text-center">Data pegawai</h3>
<hr/>

	<div class="box box-solid box-primary">
    <div class="height: 150px; width: 200px; padding: 10px;"></div>
		<div class="box-header">
		<h3 class="btn btn disabled box-title">
		<i class="fa fa-user-md"></i>
		Data Pegawai </h3>
		<a class="btn btn-default pull-right" href="?module=pegawai&aksi=tambah">
		<i class="fa  fa-plus"></i> Tambah Data pegawai</a>	
		</div>		
	<div class="box-body">
	<table id="example1" class="table table-bordered table-striped">
<thead>
	<tr class="text-blue">
        <th class="col-sm-1">NIP</th>
		<th class="col-sm-1">Nama pegawai</th>
        <th class="col-sm-1">Foto</th>
		<th class="col-sm-1">Tempat/Tgl. Lahir</th>  
		<th class="col-sm-1">No. HP</th> 
        <th class="col-sm-1">Status Pekerjaan dan Tgl. Masuk</th>
		<th class="col-sm-1">Aksi</th>
	</tr>
</thead>

<tbody>
<?php 
// Tampilkan data dari Database
$sql = "SELECT * FROM pegawai";
$tampil = mysql_query($sql);
$no=1;
while ($data = mysql_fetch_array($tampil)) { 
$Kode = $data['nip'];?>

	<tr>
	<td><a href="?module=pegawai&aksi=detail_pegawai&nip=<?php echo $data['nip'];?>"><?php echo $data['nip']; ?></a></td>
	<td><?php echo $data['nm_pegawai']; ?></td>
    <td><img src="images/<?php echo $data['images']; ?>" width="80" height="80"/></td>
	<td><?php echo $data['tpt_lhr'] .", ". IndonesiaTgl($data['tgl_lhr']); ?></td>
    <td><?php echo $data['no_hp']; ?></td>
    <td><?php echo $data['status_sk'] .", ". IndonesiaTgl($data['tgl_msk']); ?></td>
	<td align="center">
	<a class="btn btn-xs btn-info"   data-toggle="tooltip" title="Edit Data <?php echo $data['nip'];?>" href="?module=pegawai&aksi=edit&nip=<?php echo $data['nip'];?>"><i class="glyphicon glyphicon-edit"></i></a>
	<a class="btn btn-xs btn-warning"   data-toggle="tooltip" title="Hapus Semua Data Pegawai" href="<?php echo $aksi ?>?module=pegawai&aksi=hapus&nip=<?php echo $data['nip'];?>"  alt="Delete Data" onclick="return confirm('ANDA YAKIN AKAN MENGHAPUS DATA <?php echo $Kode; ?>	?')"> <i class="glyphicon glyphicon-trash"></i></a>
	</td>
	<?php
	}
	?>
	</tr>
			</tbody>
		</table>
	</div><!-- /.box-body -->
</div><!-- /.box -->

<!----- ------------------------- END MENAMPILKAN DATA MASTER pegawai ------------------------- ----->
<?php 
break;
case "tambah": 
?>
<!----- ------------------------- TAMBAH DATA MASTER pegawai ------------------------- ----->
<h3 class="box-title margin text-center">Tambah Data Pegawai Baru</h3>
<hr/>
<form class="form-horizontal" action="<?php echo $aksi?>?module=pegawai&aksi=tambah" role="form" method="post">             

<div class="box box-solid box-primary">
<div class="height: 150px; width: 200px; padding: 10px;"></div>
<div class="box-header">
<h3 class="btn btn disabled box-title">
<i class="fa fa-user-md"></i> Informasi Pegawai </h3>
	<a class="btn btn-default btn-sm pull-right" data-widget='collapse' data-toggle="tooltip" title="Collapse" style="margin-right: 5px;">
	<i class="fa fa-minus"></i></a>
		</div>	
	<div class="box-body">
  <div class="form-group">
    <label class="col-sm-4 control-label">NIP</label>
    <div class="col-sm-5">
      <input type="text" class="form-control" required="required" name="nip" >
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-4 control-label">Nama Pegawai</label>
    <div class="col-sm-5">
      <input type="text" class="form-control" required="required" name="nm_pegawai" placeholder="Nama pegawai">
    </div>
  </div>  
  <div class="form-group">
    <label class="col-sm-4 control-label">Tempat & Tgl. Lahir</label>
    <div><div class="col-sm-2">
      <input type="text" class="form-control" required="required" name="tpt_lhr" placeholder="Tempat Lahir">
	</div>
	<div class="col-sm-3">
	  <div class="input-group">
	<div class="input-group-addon">
       <i class="fa fa-calendar"> </i>
    </div>
      <input type="date" class="form-control" required="required" data-toggle="tooltip" title="Format: yyyy/dd/mm" name="tgl_lhr">
	</div><!-- /.input group -->
	</div></div>
  </div>
  <div class="form-group">
    <label class="col-sm-4 control-label">Jenis Kelamin</label>
    <div class="col-sm-5">
	  <input name="jk" class="minimal" type="radio" value="Laki-laki" checked> Laki-laki &nbsp;&nbsp;
	  <input name="jk" class="minimal" type="radio" value="Perempuan"> Perempuan
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-4 control-label">Agama</label>
    <div class="col-sm-5">	
    <select name="agama" class="form-control"><option> Pilih Agama</option>
	<option name="agama" value="Islam"> Islam </option><option name="agama" value="Kristen Protestan"> Kristen Protestan </option>
	<option name="agama" value="Kristen Katolik"> Kristen Katolik </option><option name="agama" value="Hindu"> Hindu </option>
	<option name="agama" value="Budha"> Budha </option>
	</select>
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-4 control-label">Status</label>
    <div class="col-sm-5">	
    <select name="st" class="form-control"><option> Pilih Status</option>
	<option name="st" value="Menikah"> Menikah </option>
	<option name="st" value="Belum Menikah"> Belum Menikah </option>
	</select>
    </div>
  </div>
<div class="form-group">
    <label class="col-sm-4 control-label">Alamat</label>
    <div class="col-sm-5">
      <textarea rowspan="2" class="form-control" name="alamat" placeholder="Alamat Domisili"></textarea>
    </div>
  </div>  
   <div class="form-group">
    <label class="col-sm-4 control-label">Nomor HP</label>
    <div class="col-sm-5">
      <input type="text" class="form-control"  name="no_hp" placeholder="08xx xxx xxxx">
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-4 control-label">Email</label>
    <div class="col-sm-5">
      <input type="email" class="form-control"  name="email" placeholder="">
    </div>
  </div></div>
  <div class="form-group">
      <label class="col-sm-4 control-label">Foto</label>
    <div class="col-sm-5">
      <input type="file" class="form-control"  name="images"/>
    </div>
  </div>
  </div> 
<div class="box box-solid box-primary">
<div class="height: 150px; width: 200px; padding: 10px;"></div>
<div class="box-header">
<h3 class="btn btn disabled box-title">
<i class="glyphicon glyphicon-briefcase"></i> Informasi Pekerjaan Pegawai </h3>
	<a class="btn btn-default btn-sm pull-right" data-widget='collapse' data-toggle="tooltip" title="Collapse" style="margin-right: 5px;">
	<i class="fa fa-minus"></i></a>
		</div>
<?php
  $hasil = mysql_query("SELECT max(no_sk) as terakhir from sk_krj"); $data = mysql_fetch_array($hasil);
  $lastID = $data['terakhir']; $lastNoUrut = substr($lastID,13, 20); $nextNoUrut = $lastNoUrut + 1;
  $nextID = "SK/KOM/".date('m/y')."/".sprintf("%05s",$nextNoUrut);
?>
	<div class="box-body">
<div class="form-group">
    <label class="col-sm-4 control-label">Tgl. Masuk</label>
    <div>
	<div class="col-sm-5">
	  <div class="input-group">
	<div class="input-group-addon">
            <i class="fa fa-calendar"> </i>
    </div>
      <input type="date" class="form-control" value="<?php echo date('Y-m-d'); ?>" required="required" name="tgl_msk">
	</div></div></div></div>
	<div class="form-group">
    <label class="col-sm-4 control-label">Nomor SK Pegawai</label>
    <div class="col-sm-5">
      <input type="text" class="form-control" data-toggle="tooltip" title="Nomor SK Baru" value="<?php echo $nextID; ?>"required="required" name="no_sk">
    </div></div>
    <div class="form-group">
    <label class="col-sm-4 control-label">Unit Kerja</label>
    <div class="col-sm-5">
<select name="unit_krj" class="form-control">
<option value=" "> -- Pilih Unit Kerja -- </option>
<?php $q = mysql_query ("select * from unit_krj");
while ($k = mysql_fetch_array($q)){ ?>
<option value="<?php echo $k['id_unit_krj']; ?>" 
<?php (@$h['unit_krj']==$k['unit_krj'])?print(" "):print(""); ?>	> <?php echo $k['id_unit_krj']; echo " / ".$k['nm_unit_krj']; ?>
</option> <?php	} ?>
</select>
  </div></div>  
  <div class="form-group">
    <label class="col-sm-4 control-label">Jabatan</label>
    <div class="col-sm-5">	
<select name="jabatan" class="form-control">
<option value=" "> -- Pilih Jabatan -- </option>
<?php $q = mysql_query ("select * from jabatan");
while ($k = mysql_fetch_array($q)){ ?>
<option value="<?php echo $k['id_jabatan']; ?>" 
<?php (@$h['jabatan']==$k['jabatan'])?print(" "):print(""); ?>	> <?php echo $k['id_jabatan']; echo " / ".$k['nm_jabatan']; ?>
</option> <?php	} ?>
</select>
    </div></div>  
  <div class="form-group">
    <label class="col-sm-4 control-label">Pangkat</label>
    <div class="col-sm-5">
<select name="pangkat" class="form-control">
<option value=" "> -- Pilih pangkat -- </option>
<?php $q = mysql_query ("select * from pangkat");
while ($k = mysql_fetch_array($q)){ ?>
<option value="<?php echo $k['id_pangkat']; ?>" 
<?php (@$h['pangkat']==$k['pangkat'])?print(" "):print(""); ?>	> <?php echo $k['id_pangkat']; echo " / ".$k['nm_pangkat']; ?>
</option> <?php	} ?>
</select>
  </div></div>  
  <div class="form-group">
    <label class="col-sm-4 control-label">Lokasi</label>
    <div class="col-sm-5">
<select name="lokasi" class="form-control">
<option value=" "> -- Pilih lokasi -- </option>
<?php $q = mysql_query ("select * from lokasi_krj");
while ($k = mysql_fetch_array($q)){ ?>
<option value="<?php echo $k['id_lokasi']; ?>" 
<?php (@$h['lokasi']==$k['lokasi'])?print(" "):print(""); ?>	> <?php echo $k['id_lokasi']; echo " / ".$k['nm_lokasi']; ?>
</option> <?php	} ?>
</select>
    </div></div>  

<div class="form-group">
    <label class="col-sm-4 control-label">Status Pegawai</label>
    <div class="col-sm-5">
	  <input name="status_sk" class="minimal" type="radio" value="aktif" checked> Aktif &nbsp;&nbsp;
	  <input name="status_sk" class="minimal" type="radio" value="nonaktif"> Nonaktif 
    </div></div>
    <div class="form-group">
    <label class="col-sm-4 control-label">Deskripsi</label>
    <div class="col-sm-5">
      <textarea rowspan="2" class="form-control" name="deskripsi" title="Keahlian dan jika sudah Non-Aktif (Terakhir Kerja beserta Alasan)" placeholder="Keahlian dan jika sudah Non-Aktif (Terakhir Kerja beserta Alasan)"></textarea>
    </div>
  </div>		
</div></div>	
<div class="box box-solid box-primary">
<div class="box-header">
<h3 class="btn btn disabled box-title">
<i class="fa fa-mortar-board "></i> Informasi Pendidikan </h3>
	<a class="btn btn-default btn-sm pull-right" data-widget='collapse' data-toggle="tooltip" title="Collapse" style="margin-right: 5px;">
	<i class="fa fa-minus"></i>
	</a></div>	
	<div class="box-body">
	<?php
for ($i= 1; $i <= 3; $i++) { ?>
<div class="form-group">
    <label class="col-sm-3 control-label">Jenjang/Nama Sekolah </label>
    <div><div class="col-sm-2">
    <select name="jjg[]" class="form-control">
	<option value=""> Pilih Jenjang</option>	
<?php $q = mysql_query ("select * from jjg");
while ($k = mysql_fetch_array($q)){ ?>
<option value="<?php echo $k['nm_jjg']; ?>" 
<?php (@$h['jjg']==$k['jjg'])?print(" "):print(""); ?>	> <?php echo $k['nm_jjg']; ?>
</option> <?php	} ?>
	</select>
	</div><div class="col-sm-3">
	<input type="text" class="form-control"  data-toggle="tooltip" title="Nama Sekolah" placeholder="Nama Sekolah"   name="nm_jjg[]">
	</div><div class="col-sm-3">
	  <div class="input-group">	<div class="input-group-addon">  <i class="fa fa-calendar"> </i>    </div>
      <input type="text" class="form-control"   data-toggle="tooltip" maxlength="9" title="Format: 2000-2006" placeholder="Tahun"   name="thn_jjg[]">
	</div><!-- /.input group -->
	</div></div></div>
<?php } ?>	
<div class="form-group">
<div id="main">
    <div class="my-form">
            <center>
			<p class="text-box">
                <a class="add-box btn btn-primary"" href="#"> <i class="fa fa-plus"> </i> Tambah</a>
            </p></center>
    </div>
</div>
<script type="text/javascript">
jQuery(document).ready(function($){
    $('.my-form .add-box').click(function(){
        var n = $('.text-box').length + 1;
        if( 5 < n ) {
            alert('Stop it!');
            return false;
        }
        var box_html = $('<div class="form-group"><label class="col-sm-3 control-label">Jenjang/Nama Sekolah </label><div><div class="col-sm-2"> <select name="jjg[]" class="form-control"><option value=""> Pilih Jenjang</option>	<?php $q = mysql_query ("select * from jjg");while ($k = mysql_fetch_array($q)){ ?><option value="<?php echo $k['nm_jjg']; ?>" <?php (@$h['jjg']==$k['jjg'])?print(" "):print(""); ?>	> <?php echo $k['nm_jjg']; ?></option> <?php	} ?>	</select></div><div class="col-sm-3">	<input type="text" class="form-control"  data-toggle="tooltip" title="Nama Sekolah" placeholder="Nama Sekolah" name="nm_jjg[]"> </div><div class="col-sm-3"> <div class="input-group">	<div class="input-group-addon">  <i class="fa fa-calendar"> </i>    </div>  <input type="text" class="form-control"   data-toggle="tooltip" title="Format: 2000-2006" maxlength="9" placeholder="Tahun"   name="thn_jjg[]"></div></div></div>  <a href="#" class="remove-box btn btn-danger btn-sm "><i class="fa fa-remove"> </i></a></div>');
        box_html.hide();
        $('.my-form p.text-box:last').after(box_html);
        box_html.fadeIn('slow');
        return false;
    });
    $('.my-form').on('click', '.remove-box', function(){
        $(this).parent().css( 'background-color', '#' );
        $(this).parent().fadeOut("slow", function() {
            $(this).remove();
            $('.box-number').each(function(index){
                $(this).text( index + 1 );
            });
        });
        return false;
    });
});
</script>
</div>
</div></div>	
<div class="box box-solid box-primary">
<div class="box-header">
<h3 class="btn btn disabled box-title">
<i class="fa fa-puzzle-piece"></i> Pengalaman Pekerjaan </h3>
	<a class="btn btn-default btn-sm pull-right" data-widget='collapse' data-toggle="tooltip" title="Collapse" style="margin-right: 5px;">
	<i class="fa fa-minus"></i>
	</a>
 
		</div>	
	<div class="box-body">
<div class="form-group">
    <label class="col-sm-1 control-label"></label>
    <div><div class="col-sm-4">
    <input type="text" class="form-control"  data-toggle="tooltip" title="Pekerjaan" placeholder="Pekerjaan" name="pekerjaan[]">
	</div><div class="col-sm-3">
	<input type="text" class="form-control"  data-toggle="tooltip" title="Nama Perusahaan" placeholder="Nama Perusahaan" name="nm_pt[]">
	</div><div class="col-sm-3">
	  <div class="input-group">
	<div class="input-group-addon">
       <i class="fa fa-calendar"> </i>
    </div>
      <input type="text" class="form-control"   data-toggle="tooltip" maxlength="9"title="Format: 2000-2006" placeholder="Tahun" name="thn_krj[]">
	</div><!-- /.input group -->
	</div></div>
  </div>
<div class="form-group">
<div id="main">
    <div class="form-ku">
            <center>
			<p class="text-itan">
                <a class="ad-box btn btn-primary"" href="#"> <i class="fa fa-plus"> </i> Tambah</a>
            </p></center>
    </div>
</div>
<script type="text/javascript">
jQuery(document).ready(function($){
    $('.form-ku .ad-box').click(function(){
        var n = $('.text-itan').length + 1;
        if( 5 < n ) {
            alert('Stop it!');
            return false;
        }
        var box_html = $('<div class="form-group"> <label class="col-sm-1 control-label"></label>    <div><div class="col-sm-4">    <input type="text" class="form-control"  data-toggle="tooltip" title="Pekerjaan" placeholder="Pekerjaan" name="pekerjaan[]">	</div><div class="col-sm-3">	<input type="text" class="form-control"  data-toggle="tooltip" title="Nama Perusahaan" placeholder="Nama Perusahaan" name="nm_pt[]">	</div><div class="col-sm-3">	  <div class="input-group">	<div class="input-group-addon">       <i class="fa fa-calendar"> </i>    </div>      <input type="text" class="form-control"   data-toggle="tooltip" maxlength="9"title="Format: 2000-2006" placeholder="Tahun" name="thn_krj[]">	</div> 	</div></div>  <a href="#" class="hapus-box btn btn-danger btn-sm "><i class="fa fa-remove"> </i></a></div>');
        box_html.hide();
        $('.form-ku p.text-itan:last').after(box_html);
        box_html.fadeIn('slow');
        return false;
    });
    $('.form-ku').on('click', '.hapus-box', function(){
        $(this).parent().css( 'background-color', '#' );
        $(this).parent().fadeOut("slow", function() {
            $(this).remove();
            $('.box-number').each(function(index){
                $(this).text( index + 1 );
            });
        });
        return false;
    });
});
</script>
</div>  
	</div>
</div>
	
  <div class="form-group">
    <label class="col-sm-4"></label>
    <div class="col-sm-5">
	<hr/>
      <button type="submit"name="submit" class="btn btn-primary"><i class="glyphicon glyphicon-floppy-disk"></i> Simpan</button>
<button type="reset" class="btn btn-danger"><i class="fa fa-refresh"></i> <i>Reset</i></button>
<a href="javascript:history.back()" class="btn btn-info pull-right"><i class="fa fa-backward"></i> Kembali</a>			 
    </div>
  </div> 
</form>

<!----- ------------------------- END TAMBAH DATA MASTER pegawai ------------------------- ----->
<?php
break;
case "edit":
$data=mysql_query("select * from pegawai p, sk_krj s where p.nip=s.nip and p.nip='$_GET[nip]'");
$edit=mysql_fetch_array($data);
?>
<h3 class="box-title margin text-center">Edit Data Pegawai</h3>
<hr/>

<form class="form-horizontal" action="<?php echo $aksi?>?module=pegawai&aksi=edit" role="form" method="post">             

<div class="box box-solid box-primary">
<div class="box-header">
<h3 class="btn btn disabled box-title">
<i class="fa fa-user-md"></i> Edit Informasi Pegawai </h3>
	<a class="btn btn-default btn-sm pull-right" data-widget='collapse' data-toggle="tooltip" title="Collapse" style="margin-right: 5px;">
	<i class="fa fa-minus"></i></a>
		</div>	
	<div class="box-body">  
  <div class="form-group">
    <label class="col-sm-4 control-label">NIP</label>
    <div class="col-sm-5">
      <input type="text" class="form-control" readonly value="<?php echo $edit['nip']; ?>" name="nip" >
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-4 control-label">Nama Pegawai</label>
    <div class="col-sm-5">
      <input type="text" class="form-control" value="<?php echo $edit['nm_pegawai']; ?>" name="nm_pegawai" placeholder="Nama pegawai">
    </div>
  </div>  
  <div class="form-group">
    <label class="col-sm-4 control-label">Tempat & Tgl. Lahir</label>
    <div><div class="col-sm-2">
      <input type="text" class="form-control" value="<?php echo $edit['tpt_lhr']; ?>" name="tpt_lhr" placeholder="Tempat Lahir">
	</div>
	<div class="col-sm-3">
	  <div class="input-group">
	<div class="input-group-addon">
       <i class="fa fa-calendar"> </i>
    </div>
      <input type="date" class="form-control" value="<?php echo $edit['tgl_lhr']; ?>" data-toggle="tooltip" title="Format: yyyy/dd/mm" name="tgl_lhr">
	</div><!-- /.input group -->
	</div></div>
  </div>
  <div class="form-group">
    <label class="col-sm-4 control-label">Jenis Kelamin</label>
    <div class="col-sm-5">
	  <input  class="minimal" name="jk" type="radio" value="Laki-laki" <?php if(($edit['jk'])== "Laki-laki")
				{echo "checked=\"checked\"";};?>/> Laki-laki &nbsp;&nbsp;
	  <input class="minimal" name="jk" type="radio" value="Perempuan" <?php if(($edit['jk'])== "Perempuan")
				{echo "checked=\"checked\"";};?>/> Perempuan
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-4 control-label">Agama</label>
    <div class="col-sm-5">	
    <select name="agama" class="form-control"><option> Pilih Agama</option>
	<option name="agama" value="Islam" <?php if(($edit['agama'])== "Islam")
				{echo "selected=\"selected\"";};?>> Islam </option>
			<option name="agama" value="Kristen Protestan" <?php if(($edit['agama'])== "Kristen Protestan")
				{echo "selected=\"selected\"";};?>> Kristen Protestan </option>
	<option name="agama" value="Kristen Katolik" <?php if(($edit['agama'])== "Kristen Katolik")
				{echo "selected=\"selected\"";};?>> Kristen Katolik </option>
			<option name="agama" value="Hindu" <?php if(($edit['agama'])== "Hindu")
				{echo "selected=\"selected\"";};?>> Hindu </option>
	<option name="agama" value="Budha" <?php if(($edit['agama'])== "Budha")
				{echo "selected=\"selected\"";};?>> Budha </option>
	</select>
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-4 control-label">Status</label>
    <div class="col-sm-5">	
    <select name="st" class="form-control"><option> Pilih Status</option>
	<option name="st" value="Menikah" <?php if(($edit['st'])== "Menikah")
				{echo "selected=\"selected\"";};?>> Menikah </option>
			<option name="st" value="Belum Menikah" <?php if(($edit['st'])== "Belum Menikah")
				{echo "selected=\"selected\"";};?>> Belum Menikah </option>
	</select>
    </div>
  </div>
<div class="form-group">
    <label class="col-sm-4 control-label">Alamat</label>
    <div class="col-sm-5">
      <input rowspan="2" class="form-control" value="<?php echo $edit['alamat']; ?>" name="alamat">
    </div>
  </div>  
  <div class="form-group">
    <label class="col-sm-4 control-label">Nomor HP</label>
    <div class="col-sm-5">
      <input type="text" class="form-control"  name="no_hp" placeholder="08xx xxx xxxx" value="<?php echo $edit['no_hp']; ?>">
    </div>
  </div>
  <div class="form-group">
    <label class="col-sm-4 control-label">Email</label>
    <div class="col-sm-5">
      <input type="email" class="form-control"  name="email" value="<?php echo $edit['email']; ?>">
    </div>
  </div>
  </div></div>
<div class="box box-solid box-primary">
<div class="box-header">
<h3 class="btn btn disabled box-title">
<i class="glyphicon glyphicon-briefcase"></i> Informasi Pekerjaan Pegawai </h3>
	<a class="btn btn-default btn-sm pull-right" data-widget='collapse' data-toggle="tooltip" title="Collapse" style="margin-right: 5px;">
	<i class="fa fa-minus"></i></a>
		</div>	
<div class="box-body">
<div class="form-group">
    <label class="col-sm-4 control-label">Tgl. Masuk</label>
    <div>
	<div class="col-sm-5">
	  <div class="input-group">
	<div class="input-group-addon">
            <i class="fa fa-calendar"> </i>
    </div>
      <input type="date" class="form-control" value="<?php echo $edit['tgl_msk'];?>" name="tgl_msk">
	</div></div></div></div>
<?php $sql = "SELECT * FROM sk_krj where nip='$_GET[nip]' and status_sk='aktif'";
$tampil = mysql_query($sql);
while ($data = mysql_fetch_array($tampil)) { 	?>
	<div class="form-group">
    <label class="col-sm-4 control-label">Nomor SK Pegawai</label>
    <div class="col-sm-5">
      <input type="text" class="form-control" readonly  value="<?php echo $data['no_sk'];?>" name="no_sk">
    </div></div>
    <div class="form-group">
    <label class="col-sm-4 control-label">Unit Kerja</label>
    <div class="col-sm-5">
<select name="unit_krj" class="form-control">
<option value=" "> -- Pilih Unit Kerja -- </option>
<?php $q = mysql_query ("select * from unit_krj");
while ($k = mysql_fetch_array($q)){ ?>
<option value="<?php echo $k['id_unit_krj']; ?>" <?php if(($k['id_unit_krj'])== ($data['id_unit_krj']))
				{echo "selected=\"selected\"";};?>
<?php (@$h['unit_krj']==$k['unit_krj'])?print(" "):print(""); ?>	> <?php echo $k['id_unit_krj']; echo " / ".$k['nm_unit_krj']; ?>
</option> <?php	} ?>
</select>
  </div></div>  
  <div class="form-group">
    <label class="col-sm-4 control-label">Jabatan</label>
    <div class="col-sm-5">	
<select name="jabatan" class="form-control">
<option value=" "> -- Pilih Jabatan -- </option>
<?php $q = mysql_query ("select * from jabatan");
while ($k = mysql_fetch_array($q)){ ?>
<option value="<?php echo $k['id_jabatan']; ?>" <?php if(($k['id_jabatan'])== ($data['id_jabatan']))
				{echo "selected=\"selected\"";};?>
<?php (@$h['jabatan']==$k['jabatan'])?print(" "):print(""); ?>	> <?php echo $k['id_jabatan']; echo " / ".$k['nm_jabatan']; ?>
</option> <?php	} ?>
</select>
    </div></div>  
  <div class="form-group">
    <label class="col-sm-4 control-label">Pangkat</label>
    <div class="col-sm-5">
<select name="pangkat" class="form-control">
<option value=" "> -- Pilih pangkat -- </option>
<?php $q = mysql_query ("select * from pangkat");
while ($k = mysql_fetch_array($q)){ ?>
<option value="<?php echo $k['id_pangkat']; ?>" <?php if(($k['id_pangkat'])== ($data['id_pangkat']))
				{echo "selected=\"selected\"";};?>
<?php (@$h['pangkat']==$k['pangkat'])?print(" "):print(""); ?>	> <?php echo $k['id_pangkat']; echo " / ".$k['nm_pangkat']; ?>
</option> <?php	} ?>
</select>
  </div></div>  
  <div class="form-group">
    <label class="col-sm-4 control-label">Lokasi</label>
    <div class="col-sm-5">
<select name="lokasi" class="form-control">
<option value=" "> -- Pilih lokasi -- </option>
<?php $q = mysql_query ("select * from lokasi_krj");
while ($k = mysql_fetch_array($q)){ ?>
<option value="<?php echo $k['id_lokasi']; ?>" <?php if(($k['id_lokasi'])== ($data['id_lokasi']))
				{echo "selected=\"selected\"";};?>
<?php (@$h['lokasi']==$k['lokasi'])?print(" "):print(""); ?>	> <?php echo $k['id_lokasi']; echo " / ".$k['nm_lokasi']; ?>
</option> <?php	} ?>
</select>
    </div></div> 
     	
        <div class="form-group">
    <label class="col-sm-4 control-label">Status Pegawai</label>
    <div class="col-sm-5">
	  <input name="status_sk" class="minimal" type="radio" value="aktif" checked> Aktif &nbsp;&nbsp;
	  <input name="status_sk" class="minimal" type="radio" value="nonaktif"> Nonaktif 
    </div></div>
        
         <div class="form-group">
    <label class="col-sm-4 control-label">Deskripsi</label>
    <div class="col-sm-5">
      <input type="text" class="form-control" value="<?php echo $edit['deskripsi']; ?>" placeholder="Keahlian dan jika sudah Non-Aktif (Terakhir Kerja beserta Alasan)" name="deskripsi">
    </div>
  </div>
         	
</div></div>	
<?php } ?>
<div class="box box-solid box-primary">
<div class="box-header">
<h3 class="btn btn disabled box-title">
<i class="fa fa-mortar-board "></i> Informasi Pendidikan </h3>
	<a class="btn btn-default btn-sm pull-right" data-widget='collapse' data-toggle="tooltip" title="Collapse" style="margin-right: 5px;">
	<i class="fa fa-minus"></i>
	</a></div>	
	<div class="box-body">

<?php 
// Tampilkan data dari Database
$a = mysql_query("SELECT * FROM pendidikan where nip='$_GET[nip]'");
while ($data = mysql_fetch_array($a)) { ?>

<div class="form-group">
    <label class="col-sm-3 control-label">Jenjang/Nama Sekolah </label>
    <div><div class="col-sm-2">
    <select name="jjg[]" class="form-control">
	<option value=""> Pilih Jenjang</option>
	<?php $q = mysql_query ("select * from jjg");
while ($k = mysql_fetch_array($q)){ ?>
<option value="<?php echo $k['nm_jjg']; ?>" <?php if(($k['nm_jjg'])== ($data['jenjang']))
				{echo "selected=\"selected\"";};?>
<?php (@$h['jjg']==$k['jjg'])?print(" "):print(""); ?>	> <?php echo $k['nm_jjg']; ?>
</option> <?php	} ?>

	</select>
	</div><div class="col-sm-3">
	<input type="text" class="form-control"  data-toggle="tooltip" title="Nama Sekolah" value="<?php echo $data['nm_pendidikan'];?>"   name="nm_jjg[]">
	<input type="hidden" class="form-control"  value="<?php echo $data['id_pend'];?>"   name="id_pend[]">
	</div><div class="col-sm-3">
	  <div class="input-group">	<div class="input-group-addon">  <i class="fa fa-calendar"> </i>    </div>
      <input type="text" class="form-control"   data-toggle="tooltip" title="Format: 2000-2006" maxlength="9"value="<?php echo $data['thn_pend'];?>"   name="thn_jjg[]">
	</div><!-- /.input group -->
	</div></div>
	<a class="hapus-box btn btn-danger btn-sm"   data-toggle="tooltip" title="Hapus Data" href="<?php echo $aksi ?>?module=pegawai&aksi=hapus_pend&id_pend=<?php echo $data['id_pend'];?>"  alt="Delete Data" onclick="return confirm('ANDA YAKIN AKAN MENGHAPUS DATA <?php echo $Kode; ?>	?')"> <i class="glyphicon glyphicon-trash"></i></a>
	</div>

<?php } ?>
	
<div class="form-group">
<div id="main">
    <div class="my-form">
            <center>
			<p class="text-box">
                <a class="add-box btn btn-primary"" href="#"> <i class="fa fa-plus"> </i> Add More</a>
            </p></center>
    </div>
</div>
<script type="text/javascript">
jQuery(document).ready(function($){
    $('.my-form .add-box').click(function(){
        var n = $('.text-box').length + 1;
        if( 5 < n ) {
            alert('Stop it!');
            return false;
        }
        var box_html = $('<div class="form-group"><label class="col-sm-3 control-label">Jenjang/Nama Sekolah </label><div><div class="col-sm-2"> <select name="add_jjg[]" class="form-control"><option> Pilih Jenjang</option>	<?php $q = mysql_query ("select * from jjg");while ($k = mysql_fetch_array($q)){ ?><option value="<?php echo $k['nm_jjg']; ?>" <?php (@$h['jjg']==$k['jjg'])?print(" "):print(""); ?>	> <?php echo $k['nm_jjg']; ?></option> <?php	} ?>	</select></div><div class="col-sm-3">	<input type="text" class="form-control"  data-toggle="tooltip" title="Nama Sekolah" Placeholder="Nama Sekolah" name="add_nm_jjg[]"> </div><div class="col-sm-3"> <div class="input-group">	<div class="input-group-addon">  <i class="fa fa-calendar"> </i>    </div>  <input type="text" class="form-control"   data-toggle="tooltip" title="Format: 2000-2006" maxlength="9"placeholder="Tahun"   name="add_thn_jjg[]"></div></div></div>  <a href="#" class="remove-box btn btn-danger btn-sm "><i class="fa fa-remove"> </i></a></div>');
        box_html.hide();
        $('.my-form p.text-box:last').after(box_html);
        box_html.fadeIn('slow');
        return false;
    });
    $('.my-form').on('click', '.remove-box', function(){
        $(this).parent().css( 'background-color', '#' );
        $(this).parent().fadeOut("slow", function() {
            $(this).remove();
            $('.box-number').each(function(index){
                $(this).text( index + 1 );
            });
        });
        return false;
    });
});
</script>
</div>
</div></div>	
<div class="box box-solid box-primary">
<div class="box-header">
<h3 class="btn btn disabled box-title">
<i class="fa fa-puzzle-piece"></i> Pengalaman Pekerjaan </h3>
	<a class="btn btn-default btn-sm pull-right" data-widget='collapse' data-toggle="tooltip" title="Collapse" style="margin-right: 5px;">
	<i class="fa fa-minus"></i>
	</a>
 
		</div>	
	<div class="box-body">
<?php 
// Tampilkan data dari Database
$a = mysql_query("SELECT * FROM pengalaman_krj where nip='$_GET[nip]'");
while ($data = mysql_fetch_array($a)) { ?>

<div class="form-group">
    <label class="col-sm-1 control-label"></label>
    <div><div class="col-sm-4">
	<input type="text" class="form-control"  data-toggle="tooltip" value="<?php echo $data['nm_krj'];?>"   name="pekerjaan[]">
	<input type="hidden" class="form-control"  value="<?php echo $data['id_peng_krj'];?>"   name="ids[]">
	</div>
	<div class="col-sm-3">
	<input type="text" class="form-control"  data-toggle="tooltip" value="<?php echo $data['nm_pt'];?>"   name="nm_pt[]">
	</div>
	<div class="col-sm-3">
	  <div class="input-group">	<div class="input-group-addon">  <i class="fa fa-calendar"> </i>    </div>
      <input type="text" class="form-control"   data-toggle="tooltip" maxlength="9"title="Format: 2000-2006" value="<?php echo $data['thn_krj'];?>"   name="thn_krj[]">
	</div><!-- /.input group -->
	</div></div>
	<a class="hapus-box btn btn-danger btn-sm"   data-toggle="tooltip" title="Hapus Data" href="<?php echo $aksi ?>?module=pegawai&aksi=hapus_peng_krj&id_peng_krj=<?php echo $data['id_peng_krj'];?>"  alt="Delete Data" onclick="return confirm('ANDA YAKIN AKAN MENGHAPUS DATA <?php echo $Kode; ?>	?')"> <i class="glyphicon glyphicon-trash"></i></a></div>	

<?php } ?>
	<div class="form-group">
<div id="main">
    <div class="form-ku">
            <center>
			<p class="text-itan">
                <a class="ad-box btn btn-primary"" href="#"> <i class="fa fa-plus"> </i> Add More</a>
            </p></center>
    </div>
</div>
<script type="text/javascript">
jQuery(document).ready(function($){
    $('.form-ku .ad-box').click(function(){
        var n = $('.text-itan').length + 1;
        if( 5 < n ) {
            alert('Stop it!');
            return false;
        }
        var box_html = $('<div class="form-group"> <label class="col-sm-1 control-label"></label>    <div><div class="col-sm-4">    <input type="text" class="form-control"  data-toggle="tooltip" title="Pekerjaan" placeholder="Pekerjaan" name="add_pekerjaan[]">	</div><div class="col-sm-3">	<input type="text" class="form-control"  data-toggle="tooltip" title="Nama Perusahaan" placeholder="Nama Perusahaan" name="add_nm_pt[]">	</div><div class="col-sm-3">	  <div class="input-group">	<div class="input-group-addon">       <i class="fa fa-calendar"> </i>    </div>      <input type="text" class="form-control"   data-toggle="tooltip" title="Format: 2000-2006"maxlength="9" placeholder="Tahun" name="add_thn_krj[]">	</div> 	</div></div>  <a href="#" class="hapus-box btn btn-danger btn-sm "><i class="fa fa-remove"> </i></a></div>');
        box_html.hide();
        $('.form-ku p.text-itan:last').after(box_html);
        box_html.fadeIn('slow');
        return false;
    });
    $('.form-ku').on('click', '.hapus-box', function(){
        $(this).parent().css( 'background-color', '#' );
        $(this).parent().fadeOut("slow", function() {
            $(this).remove();
            $('.box-number').each(function(index){
                $(this).text( index + 1 );
            });
        });
        return false;
    });
});
</script>
</div>  
	</div>
</div> 
	
  <div class="form-group">
    <label class="col-sm-4"></label>
    <div class="col-sm-5">
	<hr/>
<button type="submit"name="submit" class="btn btn-primary"><i class="glyphicon glyphicon-floppy-disk"></i> Simpan</button>
<button type="reset" class="btn btn-danger"><i class="fa fa-refresh"></i> <i>Reset</i></button>
<a href="javascript:history.back()" class="btn btn-info pull-right"><i class="fa fa-backward"></i> Kembali</a>			 
    </div>
  </div>
</form>
Aksi edit dan tambah
<?php
include "../../koneksi.php";
$module=$_GET['module'];
$aksi=$_GET['aksi'];

$nip = $_POST['nip'];
$nm_pegawai = $_POST['nm_pegawai'];
$jk = $_POST['jk'];
$tpt_lhr = $_POST['tpt_lhr'];
$tgl_lhr = $_POST['tgl_lhr'];
$tgl_msk = $_POST['tgl_msk'];
$alamat = $_POST['alamat'];
$no_hp = $_POST['no_hp'];
$agama = $_POST['agama'];
$email = $_POST['email'];
$st = $_POST['st'];
$deskripsi = $_POST['deskripsi'];
$images = $_FILES['images']['name'];
$tmp = $_FILES['images']['tmp_name'];
$no_sk = $_POST['no_sk'];
$id_pangkat = $_POST['pangkat'];
$id_lokasi = $_POST['lokasi'];
$id_jabatan = $_POST['jabatan'];
$id_unit_krj = $_POST['unit_krj'];
$status_sk = $_POST['status_sk'];
$path = "images/".$images;

else if($module=='pegawai' AND $aksi=='edit' ){ 
$query = mysql_query($koneksi, "UPDATE pegawai SET				 
				  nm_pegawai = '$nm_pegawai',
				  jk = '$jk',
				  alamat = '$alamat',
				  no_hp = '$no_hp',
				  tpt_lhr = '$tpt_lhr',
				  tgl_lhr = '$tgl_lhr',
				  tgl_msk = '$tgl_msk',
				  agama = '$agama',
                  st = '$st',
				  email = '$email'
				  WHERE nip = '$nip'");
$query1 = mysql_query($koneksi,"UPDATE sk_krj SET				 				  				  
				  id_jabatan = '$id_jabatan',
				  id_lokasi = '$id_lokasi',
				  id_pangkat = '$id_pangkat',
				  id_unit_krj = '$id_unit_krj',
				  tgl_sk = '$tgl_msk',
                  deskripsi = '$deskripsi',
                  status_sk = '$status_sk'				  
				  WHERE no_sk = '$no_sk'");	
header('location:../../index.php?module='.$module);

$num_input = count($_POST['add_nm_jjg']);
//input data pendidikan
for ($i = 0; $i < $num_input; $i++) {
$nip = $_POST['nip'];
$jjg = $_POST['add_jjg'][$i];
$nm_jjg = $_POST['add_nm_jjg'][$i];
$thn_jjg = $_POST['add_thn_jjg'][$i];
    $query = "insert into pendidikan (nip, thn_pend, jenjang, nm_pendidikan) 
	values('{$nip}','{$thn_jjg}', '{$jjg}','{$nm_jjg}')";
mysql_query($query) or die(mysql_error());	
}
$count = count($_POST['nm_jjg']);
for($i = 0; $i < $count; $i++){
$id = $_POST['id_pend'][$i];
$jjg = $_POST['jjg'][$i];
$nm_jjg = $_POST['nm_jjg'][$i];
$thn_jjg = $_POST['thn_jjg'][$i];	
	
		$query_nilaiupdate = "UPDATE pendidikan set thn_pend = '".$thn_jjg."',
jenjang = '".$jjg."',nm_pendidikan = '".$nm_jjg."' where id_pend = '".$id."'";
		$simpan = mysql_query($query_nilaiupdate);
	}
$counts = count($_POST['thn_krj']);
for($i = 0; $i < $counts; $i++){
$ids = $_POST['ids'][$i];
$pekerjaan = $_POST['pekerjaan'][$i];
$nm_pt = $_POST['nm_pt'][$i];
$thn_krj = $_POST['thn_krj'][$i];				
$simpan = mysql_query("UPDATE pengalaman_krj set thn_krj = '".$thn_krj."',
nm_pt = '".$nm_pt."',nm_krj = '".$pekerjaan."' where id_peng_krj = '".$ids."'");
	}
header('location:../../index.php?module='.$module);	

//input riwayat kerja
$num = count($_POST['add_pekerjaan']);
for ($j = 0; $j < $num; $j++) {
$nip = $_POST['nip'];
$nm_krj = $_POST['add_pekerjaan'][$j];
$nm_pt = $_POST['add_nm_pt'][$j];
$thn_krj = $_POST['add_thn_krj'][$j];
    $quer = "insert into pengalaman_krj (nip, thn_krj, nm_krj, nm_pt) 
	values('{$nip}','{$thn_krj}', '{$nm_krj}','{$nm_pt}')";
mysql_query($quer) or die(mysql_error());	
}
				  
header('location:../../index.php?module='.$module);
}
//Tambah
else if($module=='pegawai' AND $aksi=='tambah' ){ 
	header('location:../../index.php?module='.$module);
if(move_uploaded_file($tmp, $path))
$sql = "INSERT INTO pegawai  (nip, nm_pegawai, jk, tpt_lhr, tgl_lhr, agama, st, alamat, no_hp, email, tgl_msk, images) VALUES ('$nip', '$nm_pegawai', '$jk', '$tpt_lhr', '$tgl_lhr',  '$agama', '$st', '$alamat', '$no_hp', '$email', '$tgl_msk', '$images')";
$simpan = mysql_query($koneksi, $sql);
$sq="INSERT INTO sk_krj  (no_sk, tgl_sk, nip, id_jabatan, id_lokasi, id_pangkat, id_unit_krj, status_sk, deskripsi) VALUES ( '{$no_sk}','{$tgl_msk}','{$nip}','{$id_jabatan}', '{$id_lokasi}','{$id_pangkat}','{$id_unit_krj}','{$status_sk}', '{$deskripsi}')";
$simpa = mysql_query($koneksi, $sq);

$num_input = count($_POST['nm_jjg']);
//input data pendidikan
for ($i = 0; $i < $num_input; $i++) {
$nip = $_POST['nip'];
$jjg = $_POST['jjg'][$i];
$nm_jjg = $_POST['nm_jjg'][$i];
$thn_jjg = $_POST['thn_jjg'][$i];
    $query = "insert into pendidikan (nip, thn_pend, jenjang, nm_pendidikan) 
	values('{$nip}','{$thn_jjg}', '{$jjg}','{$nm_jjg}')";
mysql_query($query) or die(mysql_error());	
}
//input riwayat kerja
$num = count($_POST['pekerjaan']);
for ($j = 0; $j < $num; $j++) {
$nip = $_POST['nip'];
$nm_krj = $_POST['pekerjaan'][$j];
$nm_pt = $_POST['nm_pt'][$j];
$thn_krj = $_POST['thn_krj'][$j];
    $quer = "insert into pengalaman_krj (nip, thn_krj, nm_krj, nm_pt) 
	values('{$nip}','{$thn_krj}', '{$nm_krj}','{$nm_pt}')";
mysql_query($quer) or die(mysql_error());	
}
}
?>
Koneksi
<?php
$koneksi=mysql_connect("localhost","root","")
or
die("can't connect to database");
$db=mysql_select_db("00",$koneksi);
?>
  • error yang muncul apa? - Abdalhaqq
  • tidak ada error yang muncul akan tetapi data tidak bisa update pada layout halaman data pegawai dan data tidak bisa masuk database - melisya

Jawaban
foto driyan
107 Kontribusi 52 Coto
2 bulan yang lalu
pakai mysqli contoh disini


Login untuk diksusi di forum sekolah koding