Ga bisa edit

Gan, minta tolong donk ini knp ga bisa di edit yah? Ini kodenya:

 <!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />

<link rel="Shortcut Icon" href="favicon.ico" />
<title>edit Data Pemilik Hewan Kurban</title>


<script type="text/javascript" src="assets/js/jquery.js"></script>

<!-- Script Ajax untuk Mengontrol Dropdown List Bertingkat -->

<script type="text/javascript">
var htmlobjek;
$(document).ready(function(){
  //apabila terjadi event onchange terhadap object <select id=propinsi>
  $("#provinsi").change(function(){
    var provinsi = $("#provinsi").val();
    $.ajax({
        url: "getKota.php",
        data: "provinsi="+provinsi,
        cache: false,
        success: function(msg){
            //jika data sukses diambil dari server kita tampilkan
            //di <select id=kota>
            $("#kota").html(msg);
        }
    });
  });
  $("#kota").change(function(){
    var kota = $("#kota").val();
    $.ajax({
        url: "getKecamatan.php",
        data: "kota="+kota,
        cache: false,
        success: function(msg){
            $("#kec").html(msg);
        }
    });
  });
});
</script>
<body>

    <div class="content-wrapper">
    <section class="content-header">
      <h1>
        Edit Data
        <small>Pemilik Hewan Kurban</small>
      </h1>
      <ol class="breadcrumb">
        <li><a href="?page=home"><i class="fa fa-dashboard"></i> Dashboard</a></li>
        <li><a href="?page=data_pemilik_hewan_kurban">Data Pemilik Hewan Kurban</a></li>
        <li class="active">Edit Data Pemilik Hewan Kurban</li>
      </ol>
    </section>
    <div class="panel-heading">
        <div class="callout callout-danger">
        <h4>Peringatan</h4>
        Untuk mengubah data, diwajibkan memilih kembali data dropdown.
      </div>
        <a href="?page=data_pemilik_hewan_kurban" class="btn btn-info btn-sm"><i class="glyphicon glyphicon-file"></i> Lihat Data</a>
    </div>
     <?php

        $id=$_GET['id'];
        $sql = mysqli_query($koneksi, "SELECT data_pemilik_kurban.*, master_provinsi.provinsi_nama, master_kokab.kokab_nama, master_kecam.nama_kecam, petugas.NamaPetugas FROM data_pemilik_kurban
              LEFT JOIN master_provinsi ON data_pemilik_kurban.provinsi_id = master_provinsi.provinsi_id
              LEFT JOIN master_kokab ON data_pemilik_kurban.kota_id = master_kokab.kota_id
              LEFT JOIN master_kecam ON data_pemilik_kurban.kecam_id = master_kecam.kecam_id
              LEFT JOIN petugas ON data_pemilik_kurban.PetugasID = petugas.id
            WHERE data_pemilik_kurban.id=".$id) or die(mysqli_error());
        if($sql === FALSE) {
    die(mysqli_error()); // TODO: better error handling
  }
        while($r=mysqli_fetch_array($sql)){
        ?>
    <div class="panel-body">
        <form method="post" action="simpan_edit_data_pemilik_hewan_kurban2.php" enctype="multipart/form-data">
        <input type="hidden" name="id" valued="<?php echo $r['id']; ?>">
        <div class="col-md-6">
            <div class="form-group">
                <label>Nama Pemilik</label>
                <input class="form-control" name='nama_pemilik' value="<?php echo $r['NamaPemilik']; ?>" required autofocus>
            </div>
            <div class="form-group">
                <label>Alamat</label>
                <input class="form-control" name='alamat_pemilik' value="<?php echo $r['AlamatPemilik']; ?>" maxlength="255" required autofocus>
            </div>
            <div class="form-group">
                <label>Provinsi (Tersiman : <?php echo $r['provinsi_nama']; ?>)</label>
                <select class="form-control select2" name="provinsi" id="provinsi" required autofocus>
                <option value="">--Pilih Provinsi--</option>
                    <?php
                        $provinsi = mysqli_query($koneksi, "SELECT * FROM master_provinsi ORDER BY provinsi_nama");
                        while ($p=mysqli_fetch_array($provinsi)) {
                            echo "<option value=\"$p[provinsi_id]\">$p[provinsi_nama]</option>\n";
                        }
                        ?>
                </select>
           </div>
                <div class="form-group">
                    <label>Kota / Kabupaten (Tersimpan : <?php echo $r['kokab_nama']; ?>)</label>
                    <select class="form-control select2" name="kota" id="kota" width="300" required autofocus>
                        <option value="">--Pilih Kota / Kabupaten--</option>
                    <?php
                        $kota = mysqli_query($koneksi, "SELECT * FROM master_kokab ORDER BY kokab_nama");
                        while ($p=mysqli_fetch_array($kota)) {
                            echo "<option value=\"$p[kota_id]\">$p[kokab_nama]</option>\n";
                        }
                        ?>
                    </select>
                </div>
                <div class="form-group">
                    <label>Kecamatan (Tersimpan : <?php echo $r['nama_kecam']; ?>)</label>
                    <select class="form-control select2" name="kec" id="kec" width="300" required autofocus>
                        <option value="">--Pilih Kecamatan--</option>
                    </select>
                </div>
                <div class="form-group">
                    <label>No. HP / Telepon</label>
                    <input class="form-control" name='no_hp' value="<?php echo $r['NoHP']; ?>" maxlength='30' required autofocus>
                </div>
                <div class="form-group">
                    <label>Longitude (S)</label>
                    <input class="form-control" name='gps_south' value="<?php echo $r['GPSSouth']; ?>" maxlength='30' required autofocus>
                </div>
                <div class="form-group">
                    <label>Latitude (E)</label>
                    <input class="form-control" name='gps_east' value="<?php echo $r['GPSEast']; ?>" maxlength="30" required autofocus>
                </div>
            </div>
            <div class="col-md-3">
                <div class="form-group">
                    <label>Jumlah Sapi</label>
                    <input class="form-control" name='jml_sapi' value="<?php echo $r['JmlSapi']; ?>" maxlength='10' value="0">
                </div>
                 <div class="form-group">
                    <label>Asal Sapi</label>
                    <input class="form-control" name='asal_sapi' value="<?php echo $r['AsalSapi']; ?>" maxlength='100'>
                </div>
                <div class="form-group">
                    <label>Jumlah Kerbau</label>
                    <input class="form-control" name='jml_kerbau' value="<?php echo $r['JmlKerbau']; ?>" maxlength='10' value="0">
                </div>
                 <div class="form-group">
                    <label>Asal Kerbau</label>
                    <input class="form-control" name='asal_kerbau' value="<?php echo $r['AsalKerbau']; ?>" maxlength='100'>
                </div>
            </div>
            <div class="col-md-3">
                <div class="form-group">
                    <label>Jumlah Kambing</label>
                    <input class="form-control" name='jml_kambing' maxlength='10' value="<?php echo $r['JmlKambing']; ?>" value="0">
                </div>
                 <div class="form-group">
                    <label>Asal Kambing</label>
                    <input class="form-control" name='asal_kambing' value="<?php echo $r['AsalKambing']; ?>" maxlength='100'>
                </div>
                <div class="form-group">
                    <label>Jumlah Domba</label>
                    <input class="form-control" name='jml_domba' value="<?php echo $r['JmlSapi']; ?>" maxlength='10' value="0">
                </div>
                 <div class="form-group">
                    <label>Asal Domba</label>
                    <input class="form-control" name='asal_domba' value="<?php echo $r['AsalDomba']; ?>" maxlength='100' >
                </div>
                </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label>Petugas (Tersimpan : <?php echo $r['NamaPetugas']; ?>)</label>
                    <select class="form-control select2" name="petugas" id="petugas"  width="300" required autofocus>
                        <option value="">-- Pilih Petugas--</option>
                    <?php
                        $sqlpt = mysqli_query($koneksi, "SELECT * FROM petugas");
                        while ($pt=mysqli_fetch_array($sqlpt)) {
                            echo "<option value=\"$pt[id]\">$pt[NamaPetugas]</option>\n";
                        }
                        ?>
                    </select>
                </div>
                <input type="hidden" name="user" value="<?php echo $_SESSION['NamaUser']; ?>">
                    <button type="submit" class="btn btn-primary"><i class="fa fa-save"></i> Simpan</button>
                    <button type="reset" class="btn btn-default"><i class="fa fa-refresh"></i> Reset</button>
                    </div>
                </form>
             </div>
         </div>
     </div>
     <?php } ?>
    <script src="assets/js/jquery-1.10.2.js"></script>
      <!-- Bootstrap Js -->
    <script src="assets/js/bootstrap.min.js"></script>
    <script src="assets/js/jquery.dataTables.js"></script>
    <script src="assets/js/dataTables.bootstrap.js"></script>
    <script>
            $(document).ready(function () {
                $('#dataTables-example').dataTable();
            });
    </script>

</body>
</html>

Kode Simpan :

 <?php
date_default_timezone_set('Asia/Jakarta');
include '../konfigurasi-db/db-config.php';

$id 				= $_POST['id'];
$nama_pemilik		= $_POST['nama_pemilik'];
$alamat_pemilik		= $_POST['alamat_pemilik'];
$provinsi			= $_POST['provinsi'];
$kota				= $_POST['kota'];
$kecamatan			= $_POST['kec'];
$no_hp				= $_POST['no_hp'];
$gps_south		 	= $_POST['gps_south'];
$gps_east			= $_POST['gps_east'];
$jml_sapi			= $_POST['jml_sapi'];
$asal_sapi			= $_POST['asal_sapi'];
$jml_kerbau			= $_POST['jml_kerbau'];
$asal_kerbau		= $_POST['asal_kerbau'];
$jml_kambing		= $_POST['jml_kambing'];
$asal_kambing		= $_POST['asal_kambing'];
$jml_domba			= $_POST['jml_domba'];
$asal_domba			= $_POST['asal_domba'];
$petugas			= $_POST['petugas'];
$modified_date		= date("Y-m-d H:i:s");
$user				= $_POST['user'];

$input = mysqli_query($koneksi, "UPDATE data_pemilik_kurban SET
		NamaPemilik 		= '$nama_pemilik',
		AlamatPemilik 		= '$alamat_pemilik',
		provinsi_id 		= '$provinsi',
		kota_id				= '$kota',
		kecam_id 			= '$kecamatan',
		GPSEast 			= '$gps_east',
		GPSSouth 			= '$gps_east',
		NoHP 				= '$no_hp',
		JmlSapi 			= '$jml_sapi',
		AsalSapi 			= '$asal_sapi',
		JmlKerbau  			= '$jml_kerbau',
		AsalKerbau 			= '$asal_kerbau',
		JmlKambing 			= '$jml_kambing',
		AsalKambing 		= '$asal_kambing',
		JmlDomba 			= '$jml_domba',
		AsalDomba 			= '$asal_domba',
		PetugasID 			= '$petugas',
		ModifiedDate		= '$modified_date',
		User 				= '$user'
		WHERE id = '$id'") or die(mysqli_error());
if($input){
echo "<script>alert ('Data Pemilik Kurban Telah Diubah');document.location='index.php?page=data_pemilik_hewan_kurban' </script> ";
} else {
echo "<script>alert ('Gagal Ubah Data Pemilik Kurban');document.location='index.php?page=edit_data_pemilik_hewan_kurban&id=$id' </script> ";
}
?>


avatar hendrahe2885
@hendrahe2885

36 Kontribusi 0 Poin

Diperbarui 7 tahun yang lalu

5 Jawaban:

errornya apa?

avatar devio
@devio

101 Kontribusi 46 Poin

Dipost 7 tahun yang lalu

ga ada error gan. sukses ajah tp ga bs masuk. hadeuh

avatar hendrahe2885
@hendrahe2885

36 Kontribusi 0 Poin

Dipost 7 tahun yang lalu

Letakkan JavaScript di deket footer gan, soal nya kalo di atas yg di load duluan JavaScript nya, sedangkan

belum di load

avatar ardyfeb
@ardyfeb

6 Kontribusi 6 Poin

Dipost 7 tahun yang lalu

dicoba gan. hehehe

avatar hendrahe2885
@hendrahe2885

36 Kontribusi 0 Poin

Dipost 7 tahun yang lalu

masih ga bisa gan. Hadeuh knp ini?

avatar hendrahe2885
@hendrahe2885

36 Kontribusi 0 Poin

Dipost 7 tahun yang lalu

Login untuk ikut Jawaban