Pusat Ilmu Secara Detil

PHP CRUD Bootstrap part 3

PHP CRUD Bootstrap part 3

Kita akan melanjutkan tutorial tentang pembahasan CRUD berikutnya, yaitu membuat file delete.php. Bagian ini adalah bagian terakhir dari tutorial PHP CRUD Bootstrap (We will continue the tutorial about the next explanation of CRUD; create file delete.php. This section is final step of this PHP CRUD Boostrap Tutorial).

Klik Live Preview untuk melihat hasil output yang kita harapkan dan pilihlah opsi Delete (Click Live Preview to find out of the output and choose option Delete).


Membuat file delete.php yang bertujuan untuk menghapus data yang dipilih (Create file detelet.php which is be used to delete data choosen).

 require 'connection.php';
    $No= null;
        $No = $_GET['No'];
    if($No == null)
        header("Location: index.php");
    if ( !empty($_POST))
        // Delete Data
        $No = $_POST['No'];
        $query = "Delete from users where No=$No";
        header("Location: index.php");

<!DOCTYPE html>
<html lang="en">
 <meta charset="utf-8">
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
 <meta name="description" content="tutorial-boostrap-merubaha-warna">
 <meta name="author" content="ilmu-detil.blogspot.com">
 <title>Tutorial Boostrap </title>
 <link rel="stylesheet" href="assets/css/bootstrap.min.css">
 <style type="text/css">
 .navbar-default {
  background-color: #3b5998;
<nav class="navbar navbar-default">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>                        
      <h4>Detailed Technology Center</h4>
    <div class="collapse navbar-collapse" id="myNavbar">
<!-- /.navbar -->

<div class="container">
    <div class="row">
        <div class="row">
            <h3>Delete a User</h3>
  <form method="POST" action="delete.php">
   <input type="hidden" name="No" value="<?php echo $No;?>" />
   <p class="bg-danger" style="padding: 10px;">Are you sure to delete ?</p>
   <div class="form-actions">
    <button type="submit" class="btn btn-danger">Yes</button>
    <a class="btn btn btn-default" href="index.php">No</a>
    </div> <!-- /row -->


Anda dapat mengdownload keseluruhan file dilink bawah ini ( You can downloan all source code on the link below):

Untuk databasenya, anda dapat mengdownload di link berikut (For database, you can download at the following link):

Share this:

You Might Also Like:

Disqus Comments