Online Course

RF02 - Membuat Pengelolaan Data Nasabah

Membuat Pengelolaan Data Nasabah

Admin dapat mengelola Data nasabah mellaui halaman website admin.

Cara membuatnya sebagai berikut.

Pertama, Buat Tabel baru di database anda dengan nama tb_nasabah

Struktur dari tb_nasabah seperti ini

tb-nasabah

Kedua, Ganti Script pada setting_navbar.php

Ganti dengan Script ini

<!-- Bagian Navbar / menu bagian atas dan samping-->
<nav class="navbar navbar-inverse" role="navigation">
    <div class="navbar-header">
        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="#"><span class="fa fa-money"></span> SISTEM PENCAIRAN DANA</a>
    </div>
    <ul class="nav navbar-right top-nav">
            <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="label label-danger">42</span> <i class="fa fa-envelope"></i> <b class="caret"></b></a>
                    <ul class="dropdown-menu message-dropdown">
                        <li class="message-preview">
                            <a href="#">
                                <div class="media">
                                    <div class="media-body">
                                        <h5 class="media-heading"><strong>John Smith</strong>
                                        </h5>
                                        <p class="small text-muted"><i class="fa fa-clock-o"></i> Yesterday at 4:32 PM</p>
                                        <p>Lorem ipsum dolor sit amet, consectetur...</p>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li class="message-preview">
                            <a href="#">
                                <div class="media">
                                    <div class="media-body">
                                        <h5 class="media-heading"><strong>John Smith</strong>
                                        </h5>
                                        <p class="small text-muted"><i class="fa fa-clock-o"></i> Yesterday at 4:32 PM</p>
                                        <p>Lorem ipsum dolor sit amet, consectetur...</p>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li class="message-footer">
                            <a href="#">Read All New Messages</a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-bell"></i> <b class="caret"></b></a>
                    <ul class="dropdown-menu alert-dropdown">
                        <li>
                            <a href="#">Alert Name <span class="label label-default">Alert Badge</span></a>
                        </li>
                        <li>
                            <a href="#">Alert Name <span class="label label-primary">Alert Badge</span></a>
                        </li>
                        <li>
                            <a href="#">Alert Name <span class="label label-success">Alert Badge</span></a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">View All</a>
                        </li>
                    </ul>
                </li>
            <li class="dropdown">
                <a aria-expanded="false" href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo $admin['nama_admin'];?><span class="caret"></span></a>
                <ul class="dropdown-menu" role="menu">
                    <li><a href="logout.php">Logout</a></li>

                </ul>
            </li>
        </ul>
    <div id="navbar" class="navbar-collapse collapse">
        <ul class="nav navbar-nav side-nav">
            <li><a href="home.php">Home</a></li>
            <li class="dropdown">
                <a aria-expanded="false" href="#" class="dropdown-toggle" data-toggle="dropdown">File Master <span class="caret"></span></a>
                <ul class="dropdown-menu" role="menu">
                    <li><a href="nasabah.php">Data Nasabah</a></li>
                    <li><a href="plafonkredit.php">Data Plafon Kredit</a></li>
                    <li><a href="pegawai.php">Data Pegawai</a></li>
                </ul>
            </li>
            <li class="dropdown">
                <a aria-expanded="false" href="#" class="dropdown-toggle" data-toggle="dropdown">Transaksi Kredit <span class="caret"></span></a>
                <ul class="dropdown-menu" role="menu">
                    <li><a href="pengajuanbaru.php">Pengajuan Kredit Baru</a></li>
                    <li><a href="angsuran.php">Angsuran Kredit Nasabah</a></li>
                </ul>
            </li>
            <li class="dropdown">
                <a aria-expanded="false" href="#" class="dropdown-toggle" data-toggle="dropdown">Pengaturan Halaman<span class="caret"></span></a>
                <ul class="dropdown-menu" role="menu">
                    <li><a href="infobis.php">Informasi Perusahaan</a></li>
                    <li><a href="identitas.php">Informasi Website</a></li>
                    <li><a href="slider.php">Foto Slider</a></li>
                    <li><a href="profil.php">Profil Kebijakan</a></li>
                    <li><a href="admin.php">Akun Admin</a></li>
                </ul>
            </li>

        </ul>
    </div>
</nav>
<!-- Bagian Navbar / menu bagian atas dan samping-->

Ketiga, Buat file baru dengan nama nasabah.php simpan di folder adminweb

Isi dari file nasabah.php seperti ini

<?php
//pemanggilan file metatag
include "setting_metatag.php";

//pemanggilan file navbar
include "setting_navbar.php";
?>

        <div id="page-wrapper">

            <div class="container-fluid">
                <!-- .row -->
                <!-- Page Heading  breadcumb-->
                <div class="row">
                    <div class="col-lg-12">
                        <h3>
                            Data Nasabah
                            <form action="cari_nasabah.php" method="get" class="form-inline pull-right">
                            <input type="text" class="form-control" name="qw" placeholder="Masukan Nama" required>
                            <button type="submit" class="btn btn-default">Cari</button>
                            <a href="input_nasabah.php" class="btn btn-primary"><i class="fa fa-user-circle fa-fw"></i> Tambah Nasabah Baru</a>
                            </form>
                        </h3>
                        <ol class="breadcrumb">
                            <li class="active">
                                <i class="fa fa-dashboard"></i> Home
                            </li>
                            <li class="active">
                                <i class="fa fa-list"></i> Data Nasabah
                            </li>
                        </ol>
                    </div>
                </div>
                <!-- /.row -->

                <!-- .row -->
                <div class="row">

                <!-- .col lg 12 -->
                    <div class="col-lg-12">
                    <!-- /.tabel responsive -->
                                <div class="table-responsive">
                                    <table class="table table-bordered table-hover table-striped">
                                        <thead>
                                            <tr>
                                                <th>No</th>
                                                <th>Nama </th>
                                                <th>Gender </th>
                                                <th>No Telp</th>
                                                <th>Email</th>
                                                <th>Alamat</th>
                                                <th>Tanggal Masuk</th>
                                                <th>Status</th>
                                                <th>Action</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                        <?php
                                        $pg = isset( $_GET['pg'] ) ? $_GET['pg'] : "";
                                        $batas = 25; /*batas tampilan setiap halaman*/
                                        if ( empty( $pg ) ) {
                                        $posisi = 0;
                                        $pg = 1;
                                        } else {
                                        $posisi = ( $pg - 1 ) * $batas;
                                        }
                                        /*Jika variabel $pg kosong maka akan menampilkan halaman pertama dengan batas baris 10*/

                                        $ambildata=mysqli_query($conect, "SELECT * FROM tb_nasabah order by id_nasabah desc limit $posisi, $batas");
                                        $jumlah=mysqli_num_rows($ambildata);  /*mysql_num_rows untuk menghitung total baris di tabel databse*/
                                        if($jumlah == 0){  //jika tidak ada data
                                            ?>
                                        <tr>
                                            <td colspan="10">Tidak Terdapat Data</td>
                                        </tr>
                                        <?php
                                        }else{
                                        //jika ada data di tb_brand
                                        while($a=mysqli_fetch_array($ambildata)){ /*mysql_fetch array untuk mengambil data di setiap field di tabel databse*/
                                        ?>
                                        <tr>
                                            <td><?php echo $posisi=$posisi+1;?></td>
                                            <td><?php echo $a['nama_nasabah'];?></td>
                                            <td><?php echo $a['jk_nasabah'];?></td>
                                            <td><?php echo $a['telp_nasabah'];?></td>
                                            <td><?php echo $a['email_nasabah'];?></td>
                                            <td><?php echo $a['alamat_nasabah'];?></td>
                                            <td><?php echo $a['tgl_bergabung'];?></td>
                                            <td><?php echo $a['status_nasabah'];?></td>

                                            <td><a href="hapus_nasabah.php?id_nasabah=<?php echo $a['id_nasabah'];?>" onclick="return confirm('Yakin akan meghapus data ini')" title="Hapus data"><button class="btn btn-danger btn-sm"><i class="fa fa-trash-o fa-fw"></i> Hapus</button></a>
                                            <a href="edit_nasabah.php?id_nasabah=<?php echo $a['id_nasabah'];?>" title="Edit data"><button class="btn btn-primary btn-sm"><i class="fa fa-pencil-square-o fa-fw"></i> Edit</button> </a>
                                            </td>
                                        </tr>
                                        <?php
                                            }
                                        }
                                        ?>
                                        </tbody>
                                    </table>
                                </div>
                                <!-- /.tabel responsive -->

                                <div class="text-center">
                                    <?php
                                //script paging, untuk menampikan setiap halaman
                                $jml_data = mysqli_num_rows(mysqli_query($conect, "SELECT * FROM tb_nasabah order by id_nasabah desc"));
                                $JmlHalaman = ceil($jml_data/$batas); //ceil digunakan untuk pembulatan keatas
                                if($jml_data != 0){
                                if ( $pg > 1 ) {
                                $link = $pg-1;
                                $prev = "<a href='?pg=$link'><button name='prev' class='btn btn-primary btn-sm'>Prev</button></a> ";
                                } else {
                                $prev = "<button name='prev' class='btn btn-default btn-sm'>Prev </button> ";
                                }
                                $nmr = '';
                                for ( $i = 1; $i<= $JmlHalaman; $i++ ){

                                if ( $i == $pg ) {
                                $nmr .= "<button name='prev' class='btn btn-primary btn-sm'>$i</button> ";
                                } else {
                                $nmr .= "<a href='?pg=$i'><button name='prev' class='btn btn-default btn-sm'>$i</button></a> ";
                                }
                                }
                                if ( $pg < $JmlHalaman ) {
                                $link = $pg + 1;
                                $next = "<a href='?pg=$link'><button name='prev' class='btn btn-primary btn-sm'>Next</button></a> ";
                                } else {
                                $next = "<button name='prev' class='btn btn-default btn-sm'>Next</button> ";
                                }
                                echo $prev.$nmr.$next;
                                ?>
                                <br><br>
                                <span class="text-muted">Menampilkan <?php echo $jumlah; ?> dari <?php echo $jml_data; ?> Record </span>
                                <?php
                                }
                                ?>
                                </div>

                    </div>
                    <!-- /.col lg 12-->

                </div>
                <!-- /.row -->


           </div>
            <!-- /.container-fluid -->

        </div>
        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->

<?php
//pemanggilan file setting footer
include "setting_footer.php";

?>

Hasil dari file tersebut dapat di coba dengan Klik Menu File Master > Pilih Data Nasabah Maka akan muncul halaman seperti ini

nasabah

Keempat, Buat file baru dengan nama input_nasabah.php simpan di folder adminweb

Isi dari file input_nasabah.php seperti ini

<?php
//pemanggilan file metatag
include "setting_metatag.php";

//pemanggilan file navbar
include "setting_navbar.php";
?>

        <div id="page-wrapper">

            <div class="container-fluid">
                <!-- .row -->
                <!-- Page Heading  breadcumb-->
                <div class="row">
                    <div class="col-lg-12">
                        <h3>
                            Tambah Data Nasabah Baru
                            <a href="nasabah.php" class="btn btn-default pull-right">Kembali Ke Data Nasabah</a>

                        </h3>
                        <ol class="breadcrumb">
                            <li class="active">
                                Home
                            </li>
                            <li class="active">
                                Tambah Data Nasabah Baru
                            </li>
                        </ol>
                    </div>
                </div>
                <!-- /.row -->

                <?php
                //variabel setiap input di form
                $nama=mysqli_real_escape_string($conect, $_POST['nama']);   //variabel nama
                $jk=mysqli_real_escape_string($conect, $_POST['jk']);   //variabel gender
                $alamat=mysqli_real_escape_string($conect, $_POST['alamat']);   //variabel alamat
                $telp=mysqli_real_escape_string($conect, $_POST['telp']);   //variabel telp
                $pos=mysqli_real_escape_string($conect, $_POST['pos']);   //variabel kodepos
                $pass=mysqli_real_escape_string($conect, $_POST['pass']);   //variabel password
                $pass2=mysqli_real_escape_string($conect, $_POST['pass2']); //variabel ulangi password
                $email=mysqli_real_escape_string($conect, $_POST['email']);     //variabel email
                $validasi= strtolower(substr(strrchr($email,"@"),1));         //validasi email
                $pass3=md5($pass);    //password di enkripsi ke md5
                $tgl= date("Y-m-d");
                
                if(isset($_POST['simpan'])){
                    if(empty($nama)){  //jika nama kosong
                        $er_nama="<div class='alert alert-warning alert-dismissable'>
                        <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
                        <i class='fa fa-info-circle'></i> Masukan Nama Lengkap !</div>";
                    }
                    elseif(empty($jk)){  //jika gender kosong
                        $er_jk="<div class='alert alert-warning alert-dismissable'>
                        <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
                        <i class='fa fa-info-circle'></i> Pilih Jenis Kelamin!</div>";
                    }
                    elseif(empty($alamat)){  //jika alamat kosong
                        $er_alamat="<div class='alert alert-warning alert-dismissable'>
                        <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
                        <i class='fa fa-info-circle'></i> Masukan alamat !</div>";
                    }
                    elseif(empty($telp)){  //jika telepon kosong
                        $er_telp="<div class='alert alert-warning alert-dismissable'>
                        <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
                        <i class='fa fa-info-circle'></i> Masukan Nomor Telepon !</div>";
                    }
                    elseif(!is_numeric($telp)){  //jika telepon bukan angka
                        $er_telp="<div class='alert alert-warning alert-dismissable'>
                        <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
                        <i class='fa fa-info-circle'></i> Masukan Nomor Telepon Dengan Angka!</div>";
                    }
                    elseif(empty($email)){     //jika email kosong
                        $er_email="<div class='alert alert-warning alert-dismissable'>
                        <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
                        <i class='fa fa-info-circle'></i> Masukan Email Admin !</div>";
                    }
                    //jika email tidak bukan berakhiran @yahoo, gmail, atau bsi
                    elseif($validasi !="yahoo.com" && $validasi !="yahoo.co.id" && $validasi !="gmail.com" && $validasi !="bsi.ac.id"){
                        $er_email="<div class='alert alert-warning alert-dismissable'>
                        <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
                        <i class='fa fa-info-circle'></i> Masukan Email Dengan Format yahoo atau gmail !</div>";
                        }
                    elseif(empty($pass)){  //jika password kosong
                        $er_pass="<div class='alert alert-warning alert-dismissable'>
                        <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
                        <i class='fa fa-info-circle'></i> Masukan Password !</div>";
                    }
                    elseif(strlen ($pass)< 8){   //jika password kurang dari 8 karakter
                        $er_pass="<div class='alert alert-warning alert-dismissable'>
                        <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
                        <i class='fa fa-info-circle'></i> Masukan Password  Min. 8 Karakter!</div>";
                    }
                    elseif(strlen ($pass)> 15){  //jika password lebih dari 15 karakter
                        $er_pass="<div class='alert alert-warning alert-dismissable'>
                        <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
                        <i class='fa fa-info-circle'></i> Masukan Password  Max. 15 Karakter!</div>";
                        }
                    elseif(empty($pass2)){  //jika ulangi password kosong
                        $er_pass2="<div class='alert alert-warning alert-dismissable'>
                        <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
                        <i class='fa fa-info-circle'></i> Ulangi Password !</div>";
                    }
                    elseif($pass != $pass2){     //jika password dan ulangi password salah
                        $er_pass2="<div class='alert alert-warning alert-dismissable'>
                        <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
                        <i class='fa fa-info-circle'></i> Ulangi Password Dengan Benar !</div>";
                        }

                    else{   //jika semua field terisis, maka cek email apakah sudah terdaftar atau belum di tb_admin
                        $cek_email=mysqli_query($conect, "SELECT * FROM tb_nasabah where email_nasabah='$email'");
                        $email_ada=mysqli_num_rows($cek_email);
                        if($email_ada > 0){   //jika email sudah terdaftar
                            $er_email="<div class='alert alert-warning alert-dismissable'>
                            <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
                            <i class='fa fa-info-circle'></i> Email Sudah Terdaftar !</div>";
                        }else{
                            //jika email belum terdaftar maka menyimpan data ke tb_admin
                            $save=mysqli_query($conect, "INSERT INTO tb_nasabah (id_nasabah,nama_nasabah,email_nasabah,pass_nasabah,jk_nasabah,alamat_nasabah,telp_nasabah,status_nasabah,tgl_bergabung)values('','$nama','$email','$pass3','$jk','$alamat','$telp','Disetujui','$tgl')") or die(mysqli_error($conect));
                            if($save){
                                echo "<script>alert('Data Nasabah Baru Berhasil Ditambahkan');document.location='nasabah.php'</script>";
                            }else{
                                $error="<div class='alert alert-danger alert-dismissable'>
                                <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
                                <i class='fa fa-info-circle'></i> Gagal Menyimpan !</div>";
                            }
                        }
                    }
                }
                //jika memlih L maka variabel $yes akan di checked
                if($_POST['jk']=="L"){
                $yes="checked";
                }
                //jika memlih P maka variabel $no akan di checked
                elseif($_POST['jk']=="P"){
                $no="checked";
                }
                ?>

                <!-- .row -->
                <div class="row">

                <!-- .col lg 12 -->
                    <div class="col-lg-12">
                            <form action="" method="post" enctype="multipart/form-data" role="form">
                            <?php echo $error;?>
                            <div class="form-group row">
                                <label class="col-lg-2 col-md-3 col-sm-3 col-xs-12">Nama Lengkap Nasabah</label>
                                <div class="col-lg-8 col-md-7 col-sm-7 col-xs-12">
                                <input  type="text" class="form-control" placeholder="Nama Lengkap" name="nama" value="<?php echo $_POST['nama'];?>" maxlength="40">
                                </div>
                            </div>
                            <?php echo $er_nama;?>
                            <div class="form-group row">
                                <label class="col-lg-2 col-md-3 col-sm-3 col-xs-12">Jenis Kelamin [L/P]</label>
                                <div class="col-lg-8 col-md-7 col-sm-7 col-xs-12">
                                <?php echo "<input type='radio' name='jk' class='form-check-input' value='L' $yes>Laki-Laki

                                <input type='radio' name='jk' class='form-check-input' value='P' $no>Perempuan  ";?>
                                </div>
                                </div>
                            <?php echo $er_jk;?>
                            <div class="form-group row">
                                <label class="col-lg-2 col-md-3 col-sm-3 col-xs-12">Alamat Lengkap</label>
                                <div class="col-lg-8 col-md-7 col-sm-7 col-xs-12">
                                <textarea class="form-control" placeholder="Alamat" name="alamat" rows="3"><?php echo $_POST['alamat'];?></textarea>
                                </div>
                            </div>
                            <?php echo $er_alamat;?>
                           <div class="form-group row">
                                <label class="col-lg-2 col-md-3 col-sm-3 col-xs-12">No. Telepon /Hp</label>
                                <div class="col-lg-5 col-md-7 col-sm-7 col-xs-12">
                                <input  type="text" class="form-control" placeholder="Nomor Telpon" name="telp" value="<?php echo $_POST['telp'];?>" maxlength="40">
                                </div>
                            </div>
                            <?php echo $er_telp;?>
                            <div class="form-group row">
                                <label class="col-lg-2 col-md-3 col-sm-3 col-xs-12">Email</label>
                                <div class="col-lg-6 col-md-7 col-sm-7 col-xs-12">
                                <input type="email" class="form-control" placeholder="Email" name="email" value="<?php echo $_POST['email'];?>" maxlength="100">
                                </div>
                            </div>
                            <?php echo $er_email;?>

                            <hr>
                            <div class="form-group row">
                                <label class="col-lg-2 col-md-3 col-sm-3 col-xs-12">Password</label>
                                <div class="col-lg-8 col-md-7 col-sm-7 col-xs-12">
                                <input  type="password" class="form-control" placeholder="Password" name="pass" value="<?php echo $_POST['pass'];?>" maxlength="15">
                                </div>
                            </div>
                            <?php echo $er_pass;?>
                            <div class="form-group row">
                                <label class="col-lg-2 col-md-3 col-sm-3 col-xs-12">Ulangi Password</label>
                                <div class="col-lg-8 col-md-7 col-sm-7 col-xs-12">
                                <input  type="password" class="form-control" placeholder="Ulangi Password" name="pass2" value="<?php echo $_POST['pass2'];?>" maxlength="15">
                                </div>
                            </div>
                            <?php echo $er_pass2;?>


                            <button type="submit" name="simpan" class="btn btn-success">Simpan</button>

                            </form>
                                <!-- /.form -->
                    </div>
                    <!-- /.col lg 12-->

                </div>
                <!-- /.row -->


           </div>
            <!-- /.container-fluid -->

        </div>
        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->

<?php
//pemanggilan file setting footer
include "setting_footer.php";

?>

Hasil dari file tersebut seperti ini

input-nasabah

Kelima, Buat file baru dengan nama edit_nasabah.php simpan di folder adminweb

Isi dari file edit_nasabah.php seperti ini

<?php
//pemanggilan file metatag
include "setting_metatag.php";

//pemanggilan file navbar
include "setting_navbar.php";
?>

        <div id="page-wrapper">

            <div class="container-fluid">
                <!-- .row -->
                <!-- Page Heading  breadcumb-->
                <div class="row">
                    <div class="col-lg-12">
                        <h3>
                            Ubah Data Nasabah
                            <a href="nasabah.php" class="btn btn-default pull-right">Kembali Ke Data Nasabah</a>

                        </h3>
                        <ol class="breadcrumb">
                            <li class="active">
                               Home
                            </li>
                            <li class="active">
                                Edit Data Nasabah
                            </li>
                        </ol>
                    </div>
                </div>
                <!-- /.row -->

                <?php
                //ambil data dari tb memebr, tb provinsi, tb-kabupaten, tb_kecamatan, tb_kelurahan
                $tampildata=mysqli_query($conect, "SELECT * FROM tb_nasabah where id_nasabah='$_GET[id_nasabah]'");
                $b=mysqli_fetch_array($tampildata);

                //variabel setiap input di form
                $nama=mysqli_real_escape_string($conect, $_POST['nama']);   //variabel nama
                $jk=mysqli_real_escape_string($conect, $_POST['jk']);   //variabel gender
                $alamat=mysqli_real_escape_string($conect, $_POST['alamat']);   //variabel alamat
                $telp=mysqli_real_escape_string($conect, $_POST['telp']);   //variabel telp
                $pos=mysqli_real_escape_string($conect, $_POST['pos']);   //variabel kodepos
                $pass=mysqli_real_escape_string($conect, $_POST['pass']);   //variabel password
                $pass2=mysqli_real_escape_string($conect, $_POST['pass2']); //variabel ulangi password
                $email=mysqli_real_escape_string($conect, $_POST['email']);     //variabel email
                $validasi= strtolower(substr(strrchr($email,"@"),1));         //validasi email
                $pass3=md5($pass);    //password di enkripsi ke md5
                $tgl= date("Y-m-d");

                if(isset($_POST['simpan'])){
                    if(empty($nama)){  //jika nama kosong
                        $er_nama="<div class='alert alert-warning alert-dismissable'>
                        <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
                        <i class='fa fa-info-circle'></i> Masukan Nama Lengkap !</div>";
                    }
                    elseif(empty($jk)){  //jika gender kosong
                        $er_jk="<div class='alert alert-warning alert-dismissable'>
                        <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
                        <i class='fa fa-info-circle'></i> Pilih Gender Anda !</div>";
                    }
                    elseif(empty($alamat)){  //jika alamat kosong
                        $er_alamat="<div class='alert alert-warning alert-dismissable'>
                        <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
                        <i class='fa fa-info-circle'></i> Masukan alamat !</div>";
                    }
                    elseif(empty($telp)){  //jika telepon kosong
                        $er_telp="<div class='alert alert-warning alert-dismissable'>
                        <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
                        <i class='fa fa-info-circle'></i> Masukan Nomor Telepon !</div>";
                    }
                    elseif(!is_numeric($telp)){  //jika telepon bukan angka
                        $er_telp="<div class='alert alert-warning alert-dismissable'>
                        <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
                        <i class='fa fa-info-circle'></i> Masukan Nomor Telepon Dengan Angka!</div>";
                    }
                    elseif(empty($email)){     //jika email kosong
                        $er_email="<div class='alert alert-warning alert-dismissable'>
                        <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
                        <i class='fa fa-info-circle'></i> Masukan Email Admin !</div>";
                    }
                    elseif($validasi !="yahoo.com" && $validasi !="yahoo.co.id" && $validasi !="gmail.com" && $validasi !="bsi.ac.id"){
                        $er_email="<div class='alert alert-warning alert-dismissable'>
                        <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
                        <i class='fa fa-info-circle'></i> Masukan Email Dengan Format yahoo atau gmail !</div>";
                        }
                    else{   //jika semua field terisis, maka cek email apakah sudah terdaftar atau belum di tb_admin
                    if($email != $b['email_nasabah']){ //jika email yang dimasukan berbeda dengan email sebelumnya
                        $cek_email=mysqli_query($conect, "SELECT * FROM tb_nasabah where email_nasabah='$email'");
                        $email_ada=mysqli_num_rows($cek_email);
                        if($email_ada > 0){   //jika email sudah terdaftar
                            $er_email="<div class='alert alert-warning alert-dismissable'>
                            <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
                            <i class='fa fa-info-circle'></i> Email Sudah Terdaftar !</div>";
                        }else{
                            //jika email belum terdaftar maka menyimpan data ke tb_admin
                            $save=mysqli_query($conect, "UPDATE tb_nasabah set nama_nasabah='$nama',email_nasabah='$email',jk_nasabah='$jk',alamat_nasabah='$alamat',telp_nasabah='$telp' where id_nasabah='$_GET[id_nasabah]'");
                            if($save){
                                echo "<script>alert('Data Nasabah Berhasil Diubah');document.location='nasabah.php'</script>";
                            }else{
                                $error="<div class='alert alert-danger alert-dismissable'>
                                <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
                                <i class='fa fa-info-circle'></i> Gagal Menyimpan !</div>";
                            }
                        }
                    }else{
                            //jika email tidak diubah
                            $save=mysqli_query($conect, "UPDATE tb_nasabah set nama_nasabah='$nama',jk_nasabah='$jk',alamat_nasabah='$alamat',telp_nasabah='$telp' where id_nasabah='$_GET[id_nasabah]'");
                            if($save){
                                echo "<script>alert('Data Nasabah Berhasil diubah');document.location='nasabah.php'</script>";
                            }else{
                                $error="<div class='alert alert-danger alert-dismissable'>
                                <button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>
                                <i class='fa fa-info-circle'></i> Gagal Menyimpan !</div>";
                            }
                        }
                    }
                }
                //jika memlih L maka variabel $yes akan di checked
                if($b['jk_nasabah']=="L"){
                $yes="checked";
                }
                //jika memlih P maka variabel $no akan di checked
                elseif($b['jk_nasabah']=="P"){
                $no="checked";
                }
                ?>

                <!-- .row -->
                <div class="row">

                <!-- .col lg 12 -->
                    <div class="col-lg-12">

                    <form action="" method="post" enctype="multipart/form-data" role="form">
                            <?php echo $error;?>
                            <div class="form-group row">
                                <label class="col-lg-2 col-md-3 col-sm-3 col-xs-12">Nama Lengkap Nasabah</label>
                                <div class="col-lg-8 col-md-7 col-sm-7 col-xs-12">
                                <input  type="text" class="form-control" placeholder="Nama nasabah" name="nama" value="<?php echo $b['nama_nasabah'];?>" maxlength="40">
                                </div>
                            </div>
                            <?php echo $er_nama;?>
                            <div class="form-group row">
                                <label class="col-lg-2 col-md-3 col-sm-3 col-xs-12">Jenis Kelmain [L/P]</label>
                                <div class="col-lg-8 col-md-7 col-sm-7 col-xs-12">
                                <?php echo "<input type='radio' name='jk' class='form-check-input' value='L' $yes>Laki-Laki

                                <input type='radio' name='jk' class='form-check-input' value='P' $no>Perempuan  ";?>
                                </div>
                                </div>
                            <?php echo $er_jk;?>
                            <div class="form-group row">
                                <label class="col-lg-2 col-md-3 col-sm-3 col-xs-12">Alamat</label>
                                <div class="col-lg-8 col-md-7 col-sm-7 col-xs-12">
                                <textarea class="form-control" placeholder="Alamat" name="alamat" rows="3"><?php echo $b['alamat_nasabah'];?></textarea>
                                </div>
                            </div>
                            <?php echo $er_alamat;?>
                           <div class="form-group row">
                                <label class="col-lg-2 col-md-3 col-sm-3 col-xs-12">No. Telepon/HP</label>
                                <div class="col-lg-5 col-md-7 col-sm-7 col-xs-12">
                                <input  type="text" class="form-control" placeholder="Nomor Telpon" name="telp" value="<?php echo $b['telp_nasabah'];?>" maxlength="40">
                                </div>
                            </div>
                            <?php echo $er_telp;?>
                            <div class="form-group row">
                                <label class="col-lg-2 col-md-3 col-sm-3 col-xs-12">Email</label>
                                <div class="col-lg-6 col-md-7 col-sm-7 col-xs-12">
                                <input type="email" class="form-control" placeholder="Email" name="email" value="<?php echo $b['email_nasabah'];?>" maxlength="100">
                                </div>
                            </div>
                            <?php echo $er_email;?>
                            <button type="submit" name="simpan" class="btn btn-success">Simpan</button>

                            </form>
                                <!-- /.form -->
                            </div>
                    <!-- /.col lg 12-->

                </div>
                <!-- /.row -->


           </div>
            <!-- /.container-fluid -->

        </div>
        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->

<?php
//pemanggilan file setting footer
include "setting_footer.php";

?>

Hasil dari file tersebut seperti ini

edit-nasabah

Keenam, Buat file baru dengan nama hapus_nasabah.php simpan di folder adminweb

Isi dari file hapus_nasabah.php seperti ini

<?php
session_start();
//panggil koneksi
include "../assets/relasi/koneksi.php";

$id=$_GET['id_nasabah'];  //dapatkan id

if(isset($id)){ //jika ada id
//hapus data di tabel
$hapus=mysqli_query($conect, "DELETE from tb_nasabah where id_nasabah='$id'");
//jika hapus berhasil
if($hapus){
    echo"<script>alert('Data Berhasil di Hapus');document.location='nasabah.php'</script>";
}
else{ //jika gagal
    echo"<script>alert('Error Bos !!');document.location='nasabah.php'</script>";
}

}
?>

Ketujuh, Buat file baru dengan nama cari_nasabah.php simpan di folder adminweb

Isi dari file cari_nasabah.php seperti ini

<?php
//pemanggilan file metatag
include "setting_metatag.php";

//pemanggilan file navbar
include "setting_navbar.php";
?>

        <div id="page-wrapper">

            <div class="container-fluid">
                <!-- .row -->
                <!-- Page Heading  breadcumb-->
                <div class="row">
                    <div class="col-lg-12">
                        <h3>
                            Pencarian Data Nasabah > <?php echo $_GET['qw'];?>
                            <form action="cari_nasabah.php" method="get" class="form-inline pull-right">
                            <input type="text" class="form-control" name="qw" placeholder="Masukan Nama" value="<?php echo $_GET['qw'];?>" required>
                            <button type="submit" class="btn btn-default">Cari</button>
                            <a href="input_nasabah.php" class="btn btn-primary"><i class="fa fa-user-circle fa-fw"></i> Tambah Nasabah Baru</a>
                            </form>
                        </h3>
                        <ol class="breadcrumb">
                            <li class="active">
                                <i class="fa fa-dashboard"></i> Home
                            </li>
                            <li class="active">
                                <i class="fa fa-list"></i> Pencarian Data Nasabah
                            </li>
                        </ol>
                    </div>
                </div>
                <!-- /.row -->

                <!-- .row -->
                <div class="row">

                <!-- .col lg 12 -->
                    <div class="col-lg-12">
                    <!-- /.tabel responsive -->
                                <div class="table-responsive">
                                    <table class="table table-bordered table-hover table-striped">
                                        <thead>
                                            <tr>
                                                <th>No</th>
                                                <th>Nama </th>
                                                <th>Gender </th>
                                                <th>No Telp</th>
                                                <th>Email</th>
                                                <th>Alamat</th>
                                                <th>Tanggal Masuk</th>
                                                <th>Status</th>
                                                <th>Action</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                        <?php
                                        $pg = isset( $_GET['pg'] ) ? $_GET['pg'] : "";
                                        $batas = 25; /*batas tampilan setiap halaman*/
                                        if ( empty( $pg ) ) {
                                        $posisi = 0;
                                        $pg = 1;
                                        } else {
                                        $posisi = ( $pg - 1 ) * $batas;
                                        }
                                        /*Jika variabel $pg kosong maka akan menampilkan halaman pertama dengan batas baris 10*/

                                        $ambildata=mysqli_query($conect, "SELECT * FROM tb_nasabah where nama_nasabah LIKE '$_GET[qw]%' order by id_nasabah desc limit $posisi, $batas");
                                        $jumlah=mysqli_num_rows($ambildata);  /*mysql_num_rows untuk menghitung total baris di tabel databse*/
                                        if($jumlah == 0){  //jika tidak ada data
                                            ?>
                                        <tr>
                                            <td colspan="10">Tidak Terdapat Data</td>
                                        </tr>
                                        <?php
                                        }else{
                                        //jika ada data di tb_brand
                                        while($a=mysqli_fetch_array($ambildata)){ /*mysql_fetch array untuk mengambil data di setiap field di tabel databse*/
                                        ?>
                                        <tr>
                                            <td><?php echo $posisi=$posisi+1;?></td>
                                            <td><?php echo $a['nama_nasabah'];?></td>
                                            <td><?php echo $a['jk_nasabah'];?></td>
                                            <td><?php echo $a['telp_nasabah'];?></td>
                                            <td><?php echo $a['email_nasabah'];?></td>
                                            <td><?php echo $a['alamat_nasabah'];?></td>
                                            <td><?php echo $a['tgl_bergabung'];?></td>
                                            <td><?php echo $a['status_nasabah'];?></td>

                                            <td><a href="hapus_nasabah.php?id_nasabah=<?php echo $a['id_nasabah'];?>" onclick="return confirm('Yakin akan meghapus data ini')" title="Hapus data"><button class="btn btn-danger btn-sm"><i class="fa fa-trash-o fa-fw"></i> Hapus</button></a>
                                            <a href="edit_nasabah.php?id_nasabah=<?php echo $a['id_nasabah'];?>" title="Edit data"><button class="btn btn-primary btn-sm"><i class="fa fa-pencil-square-o fa-fw"></i> Edit</button> </a>
                                            </td>
                                        </tr>
                                        <?php
                                            }
                                        }
                                        ?>
                                        </tbody>
                                    </table>
                                </div>
                                <!-- /.tabel responsive -->

                                <div class="text-center">
                                    <?php
                                //script paging, untuk menampikan setiap halaman
                                $jml_data = mysqli_num_rows(mysqli_query($conect, "SELECT * FROM tb_nasabah where nama_nasabah LIKE '$_GET[qw]%' order by id_nasabah desc"));
                                $JmlHalaman = ceil($jml_data/$batas); //ceil digunakan untuk pembulatan keatas
                                if($jml_data != 0){
                                if ( $pg > 1 ) {
                                $link = $pg-1;
                                $prev = "<a href='?pg=$link'><button name='prev' class='btn btn-primary btn-sm'>Prev</button></a> ";
                                } else {
                                $prev = "<button name='prev' class='btn btn-default btn-sm'>Prev </button> ";
                                }
                                $nmr = '';
                                for ( $i = 1; $i<= $JmlHalaman; $i++ ){

                                if ( $i == $pg ) {
                                $nmr .= "<button name='prev' class='btn btn-primary btn-sm'>$i</button> ";
                                } else {
                                $nmr .= "<a href='?pg=$i'><button name='prev' class='btn btn-default btn-sm'>$i</button></a> ";
                                }
                                }
                                if ( $pg < $JmlHalaman ) {
                                $link = $pg + 1;
                                $next = "<a href='?pg=$link'><button name='prev' class='btn btn-primary btn-sm'>Next</button></a> ";
                                } else {
                                $next = "<button name='prev' class='btn btn-default btn-sm'>Next</button> ";
                                }
                                echo $prev.$nmr.$next;
                                ?>
                                <br><br>
                                <span class="text-muted">Menampilkan <?php echo $jumlah; ?> dari <?php echo $jml_data; ?> Record </span>
                                <?php
                                }
                                ?>
                                </div>

                    </div>
                    <!-- /.col lg 12-->

                </div>
                <!-- /.row -->


           </div>
            <!-- /.container-fluid -->

        </div>
        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->

<?php
//pemanggilan file setting footer
include "setting_footer.php";

?>

Ok. Selesai, Silahkan coba semuanya

Develindo Web | Tutorial Pemrograman Website