Postingan lainnya
Kelas Premium!
Belajar bikin website dari nol sekarang
Gunakan kupon "lebihcepat" untuk diskon 25%!
Modal Edit dan Delete Tidak Berfungsi
Saya membuat button Edit dan Delete yang akan memunculkan modal jika diklik
Modal Edit hanya muncul sampai header modal sedangkan isi modal tidak muncul
Modal Delete datanya tidak terhapus
Saya bingung salahnya dimana karena tidak ada Error, mohon bantuannya kak
Berikut script saya
<?php
include('config.php');
$con=mysqli_connect("localhost","root","","hris");
?>
<!DOCTYPE html>
<head>
<title></title>
</head>
<!-- ikon edit dan delete -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css" integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
<!-- <link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css"> -->
<body>
<div class="container" style="margin-top:20px">
<center><font size="6">Data Lowongan Kerja</font></center>
<hr>
<a href="#" class="btn btn-dark right" data-toggle="modal" data-target="#tambahlowongan">Tambah Lowongan</a>
<div class="table-responsive">
<table class="table table-striped jambo_table bulk_action">
<thead>
<tr>
<th>No.</th>
<th>ID Lowongan</th>
<th>Nama Lowongan</th>
<th>Jabatan Lowongan</th>
<th>Tanggal Dibuka</th>
<th>Tanggal Ditutup</th>
<th>Keterangan</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
<?php
//query ke database SELECT tabel mahasiswa urut berdasarkan id yang paling besar
$sql = mysqli_query($con, "SELECT * FROM lowongan ORDER BY id_loker DESC") or die(mysqli_error($con));
//jika query diatas menghasilkan nilai > 0 maka menjalankan script di bawah if...
if(mysqli_num_rows($sql) > 0){
//membuat variabel $no untuk menyimpan nomor urut
$no = 1;
//melakukan perulangan while dengan dari dari query $sql
while($data = mysqli_fetch_assoc($sql)){
//menampilkan data perulangan
?>
<tr>
<td><?php echo $no;?></td>
<td><?php echo $data['id_loker'];?></td>
<td><?php echo $data['nama_loker'];?></td>
<td><?php echo $data['jabatan_loker'];?></td>
<td><?php echo $data['tgl_buka'];?></td>
<td><?php echo $data['tgl_tutup'];?></td>
<td><?php echo $data['keterangan_loker'];?></td>
<td>
<a href="#" class="btn btn-light btn-xs" data-toggle="modal" data-target="#updatelowongan<?php echo $no; ?>"><i class="fas fa-edit" style="color:green"></i></a>
<a href="#" class="btn btn-light btn-xs" data-toggle="modal" data-target="#deletelowongan<?php echo $no; ?>"><i class="fas fa-trash-alt" style="color:red"></i></a>
<!-- modal delete -->
<div class="example-modal">
<div id="deletelowongan<?php echo $no; ?>" class="modal fade" role="dialog" style="display:none;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-right: -300px;margin-top:-30px"><span aria-hidden="true">×</span></button>
<h2 class="modal-title">Konfirmasi Delete Data Lowongan</h2>
</div>
<div class="modal-body">
<h2 align="center" >Apakah anda yakin ingin menghapus lowongan id <?php echo $row['id_loker'];?><strong><span class="grt"></span></strong> ?</h2>
</div>
<div class="modal-footer">
<button id="nodelete" type="button" class="btn btn-danger pull-left" data-dismiss="modal">Cancel</button>
<a href="function_lowongan.php?act=deletelowongan&id=<?php echo $row['id_loker']; ?>" class="btn btn-primary">Delete</a>
</div>
</div>
</div>
</div>
</div><!-- modal delete -->
<!-- modal update user -->
<div class="example-modal">
<div id="updatelowongan<?php echo $no;?>" class="modal fade" role="dialog" style="display:none;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h3 class="modal-title">Edit Data Lowonganaaaa</h3>
</div>
<div class="modal-body">
<form action="function_lowongan.php?act=updatelowongan" method="post" role="form">
<?php
$id_loker = $row['id_loker'];
$query = "SELECT * FROM lowongan WHERE id_loker='$id_loker'";
$result = mysqli_query($koneksi, $query);
while ($row = mysqli_fetch_assoc($result)) {
?>
<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label text-right">Id Lowongan <span class="text-red">*</span></label>
<div class="col-sm-8"><input type="text" class="form-control" name="id_loker" placeholder="Id Lowongan" value="<?php echo $row['id_loker']; ?>"></div>
</div>
</div>
<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label text-right">Nama <span class="text-red">*</span></label>
<div class="col-sm-8"><input type="text" class="form-control" name="nama_loker" placeholder="Nama" value="<?php echo $row['nama_loker']; ?>"></div>
</div>
</div>
<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label text-right">Jabatan<span class="text-red">*</span></label>
<div class="col-sm-8"><input type="text" class="form-control" name="jabatan_loker" placeholder="Jabatan" value="<?php echo $row['jabatan_loker']; ?>"></div>
</div>
</div>
<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label text-right">Tanggal Buka <span class="text-red">*</span></label>
<div class="col-sm-8"><input type="date" class="form-control" name="tgl_buka" value="<?php echo $row['tgl_buka']; ?>"></div>
</div>
</div>
<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label text-right">Tanggal Tutup <span class="text-red">*</span></label>
<div class="col-sm-8"><input type="date" class="form-control" name="tgl_tutup" value="<?php echo $row['tgl_tutup']; ?>"></div>
</div>
</div>
<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label text-right">Keterangan <span class="text-red">*</span></label>
<div class="col-sm-8"><input type="text" class="form-control" name="keterangan_loker" placeholder="Keterangan" value="<?php echo $row['keterangan_loker']; ?>"></div>
</div>
</div>
<div class="modal-footer">
<button id="noedit" type="button" class="btn btn-danger pull-left" data-dismiss="modal">Batal</button>
<input type="submit" name="submit" class="btn btn-primary" value="Update">
</div>
<?php
}
?>
</form>
</div>
</div>
</div>
</div>
</div><!-- modal update user -->
</td>
</tr>
<?php
$no++;
}
}else{
echo '
<tr>
<td colspan="7">Tidak ada data.</td>
</tr>
';
}
?>
</tbody>
</table>
</div>
</div>
<!-- modal insert -->
<div class="example-modal">
<div id="tambahlowongan" class="modal fade" role="dialog" style="display:none;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="margin-right: -220px;margin-top:-30px"><span aria-hidden="true">×</span></button>
<h3 class="modal-title">Lowongan Baru</h3>
</div>
<div class="modal-body">
<form action="function_lowongan.php?act=tambahlowongan" method="post" role="form">
<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label text-right">Id Lowongan</label>
<div class="col-sm-8"><input type="hidden" class="form-control" name="id_loker" placeholder="Id Lowongan" value=""></div>
</div>
</div>
<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label text-right">Divisi </label>
<div class="col-sm-8"><input type="text" class="form-control" name="nama_loker" placeholder="Nama" value="" required></div>
</div>
</div>
<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label text-right">Jabatan</label>
<div class="col-sm-8"><input type="text" class="form-control" name="jabatan_loker" placeholder="Jabatan" value="" required></div>
</div>
</div>
<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label text-right">Tanggal Buka</label>
<div class="col-sm-8"><input type="date" class="form-control" name="tgl_buka" value="" required></div>
</div>
</div>
<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label text-right">Tanggal Tutup</label>
<div class="col-sm-8"><input type="date" class="form-control" name="tgl_tutup" value="" required></div>
</div>
</div>
<div class="form-group">
<div class="row">
<label class="col-sm-3 control-label text-right">Keterangan</label>
<div class="col-sm-8"><input type="text" class="form-control" name="keterangan_loker" placeholder="Keterangan" value="" required></div>
</div>
</div>
<div class="modal-footer">
<button id="nosave" type="button" class="btn btn-danger pull-left" data-dismiss="modal">Batal</button>
<input type="submit" name="submit" class="btn btn-primary" value="Simpan">
</div>
<!--<div class="box-footer">
<a href="../user/data_user.php" class="btn btn-danger"><i class="fa fa-close"></i> Batal</a>
<input type="submit" name="submit" class="btn btn-primary" value="Simpan">
</div> /.box-footer -->
</form>
</div>
</div>
</div>
</div>
</div><!-- modal insert close -->
</body>
</html>
0
1 Jawaban:
<pre><a href="#" .........................</pre><div><br>sepertinya harus di isi url dari halaman yang ingin dituju. <br><br></div>
0