You are on page 1of 7

1. Koneksi.

php
<?php
$koneksi=mysqli_connect("localhost","root","","db_harian1");
?>
2. Input.php
<link rel="stylesheet" type="text\css" href="dist\css\bootstrap.css">
<link rel="stylesheet" type="text/css" href="dist\css\bootstrap.min.css">
<div class="content col-md-4 col-md-offset-4 alert-danger" style="margin-top:150px;">
<div>
<form action="proses.php" class="form" method="POST">
<div class="modal-header text-center">
<h2>Input</h2>
</div><br>
<input type="text" name="id" placeholder="Id" class="form-control input-xs">
</div><br>
<div class="form group">
<input type="text" name="nama" placeholder="Nama" class="form-control input-xs">
</div><br>
<div class="form group">
<input type="text" name="jk" placeholder="jk" class="form-control input-xs">
</div><br>
<div class="form group">
<input type="text" name="alamat" placeholder="Alamat" class="form-control input-xs">
</div><br>
<div class="form group">
<input type="submit" value="simpan" class="btn btn-danger" style="width:100%;">
</div>
</form>
</div>
</div>
3. Index.php
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="kontener"></div>
<div class="header">
<h1>SELAMAT DATANG</h1>
</div>
<div class="menu">
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="input.php">Input data</a></li>
<li><a href="tampil.php">Tampil data</a></li>
</ul>
</div>
<div class="konten">konten</div>
<div class="footer"></div>
</body>
</html>

4. Tampil.php
<?php include"koneksi.php";
$query=mysqli_query($koneksi,"SELECT*FROM pelanggan");
?>
<table border="1" width="500">
<tr>
<td>id</td>
<td>nama</td>
<td>jk</td>
<td>alamat</td>
<td>aksi</td>
</tr>
<?php while($data=mysqli_fetch_array($query)) {?>
<tr>
<td><?php echo $data['id'] ?></td>
<td><?php echo $data['nama'] ?></td>
<td><?php echo $data['jk'] ?></td>
<td><?php echo $data['alamat'] ?></td>
<td><a href="hapus.php?id=<?php echo $data['id'];?>">hapus</a>
<a href="update.php?id=<?php echo $data['id'];?>">update</a></td>
</tr>
<?php }?>
</table>
<a href="input.php">kembali</a>

5. Proses.php
<?php
include"koneksi.php";
$id=$_POST['id'];
$nama=$_POST['nama'];
$jk=$_POST['jk'];
$alamat=$_POST['alamat'];
$simpan=mysqli_query($koneksi,"INSERT INTO pelanggan
VALUES('$id','$nama','$nama','$alamat')");
if($simpan){
}
header('location:tampil.php');
?>
6. Prosesupdate.php
<?php
include"koneksi.php";
$id=$_POST['id'];
$nama=$_POST['nama'];
$jk=$_POST['jk'];
$alamat=$_POST['alamat'];
$simpan=mysqli_query($koneksi,"UPDATE pelanggan SET
nama='$nama',jk='$jk',alamat='$alamat' where id='$id'");
if($simpan){
header('location:tampil.php');
}
echo "data gagal disimpan";
?>
7. Update.php
<div>
<h3>UPDATE PELANGGAN</h3>
<?php
include"koneksi.php";
$id=$_GET['id'];
$update=mysqli_query($koneksi,"SELECT*FROM pelanggan where id='$id'");
$data=mysqli_fetch_array($update); ?>
<form action="prosesupdate.php" method="POST">
<input type="number" name="id" value="<?php echo $data['id']; ?>">
<label>nama</label>
<input type="text" name="nama" value="<?php echo $data['nama']; ?>">
<label>jk</label>
<input type="text" name="jk" value="<?php echo $data['jk']; ?>">
<label>alamat</label>
<input type="text" name="alamat" value="<?php echo $data['alamat']; ?>">
<input type="submit" value="simpan">
</div>
8. Hapus.php
<?php
include "koneksi.php";
$id=$_GET['id'];
$hapus=mysqli_query($koneksi,"DELETE FROM pelanggan where id='$id'");
if ($hapus) {
header('location:tampil.php');
}
?>
9. Config.php
<link href="bootstrap.css">
<link href="bootstrap.min.css">
<script href="bootstrap.js"></script>
<script href="bootstrap.min.js"></script>
10. Style.css
.tabel{
margin:0 auto;
color: blue
background: grey;
}

.kontener{
margin: 50px;
padding: 0px;
}
.header{
background: yellow;
color: black;
width: 100%;
height: 100px;
text-align: center;
border-radius: 10px;
}
.footer{
margin-top: 10px;
text-align: center;
background: skyblue;
color: black;
width: 100%;
height: 50px;
border-radius: 10px;

}
.konten{
margin-top: 10px;
margin-bottom: 5px;
background: grey;
color: yellow;
width: 100%;
text-align: center;
border-radius: 10px;
height: 60px;
}
.menu{
width: 100%;
background: pink;
margin: 0;
height: 100px;
border-radius: 10px;
1. Tampilan Index
2. Tampilan Input
MODUL PEMBELAJARAN WEB DESIGN

Dibuat oleh:
Deni Miftahul Adha
Fitri Wulandari

SMK BABUNNAJAH
MENES PANDEGLANG
TAHUN 2019

You might also like