Nomor 2

Edit file index.php seperti ini :

<?php

error_reporting(~E_NOTICE); #ini digunakan utk menyembunyikan error khusus notice khususnya di index / beranda

$koneksi = new mysqli("localhost", "root", "", "db_kk0918");

if ($koneksi->connect_error)

{

echo "Gagal terhubung karena " . $koneksi->connect_error;

}

?>

<style>

.button

{

height:30px;

width:100px;

margin:20px;

color:#FFFFFF;

text-align:center;

background:#A9A9A9;

border:solid 4px#00FF00;

display:table;

transition:4s ease-in;

}

.button:hover{background-color: black;}

</style>

<table border = "1" width = "90%" align ="center">

<tr align="center">

<td colspan="2"><img src="images/header.png"height="70px" width="100%"></td>

</tr>

<tr>

<td width ="35">

<h3>Menu</h3>

<a href="index.php"class="button">beranda</a>

<a href="index.php?hal=Tentang.php"class="button">Tentang</a>

<a href="index.php?hal=Entry.php"class="button">Entry(C)</a>

<a href="index.php?hal=Tampil.php"class="button">Tampil(R)</a>

<a href="index.php?hal=Ubah.php"class="button">Ubah(U)</a>

<a href="index.php?hal=Hapus.php"class="button">Hapus(D)</a>

</td>

<td align="justify">

<?php

$hal =$_GET["hal"];

if(isset($hal)&&$hal!="")

include($hal);

else

{

echo"<h1>Selamat Datang </h1><p>Saya datang dari Habang, jauh menuntut ilmu, biarlah yang penting saya bisa.saya yakin pasti bisa<strong>#nekbisanekkawa</strong></p>";

}

?>

</td>

</tr>

<tr align="center">

<td colspan="2" background="images/akbar.png">footer</td>

</tr>

</table>


Agar tombol simpan bisa menjadi tulisan putih,latar belakang hitam dan bingkai merah, maka :

<style>

.button1

{

height:25px;

width:100px;

margin:20px;

color:#FFFFFF;

text-align:center;

background:black;

border:solid 4px red;

display:table;

transition:.3e ease-in;

}

</style>

<form method="POST">

<h1> Entry Data Barang</h1>

<table>

<tr>

<td>Kode Barang:</td>

<td><input type="text"name ="txtKd"></td>

</tr>

<tr>

<td>Nama Barang:</td>

<td><input type ="text"name="txtNm"></td>

</tr>

<tr>

<td>Harga:</td>

<td><input type ="text"name="txHr" onkeyup="this.value.replace(/[^\d]/,")"></td>

</tr>

<tr>

<td colspan="2">

<input type="submit" value="Simpan" name ="btnSimpan"class="button1">

</td>

</tr>

</table>

</form>

<?php

if(isset($_POST["Simpan"]))

{

#tampung ke variabel yang isian dri form

$kode=$_POST["txKd"];

$nama=$_POST["txNm"];

$harga=$_POST["txHr"];

#coba cek Ga ada isinya

echo $kode.$nama.$harga;

$query = $koneksi->query("INSERT INTO 'db_kk0918'.'barang'('KdBrg','NmBrg','Harga')VALUES('$kode','$nama','$harga')");

}#akhir tombol simpan diklik

?>