Tabel DVD (Simpan Dengan dvd) |
Gambar 1.0 Ketika Button Simpan Di Click Maka Tampil Gambar 2.0 |
Gambar 2.0 Ketika "Lihat" Diclick Maka Tampil Gambar 3.0 |
Gambar 3.0 Ketika "Back" Diclick Maka Tampil Gambar 1.0 |
Sebelum Membuat input.php Buat Terlebih Dahulu koneksi.php.
Coding/Lising koneksi.php:
<?php
$koneksi=mysql_connect("localhost","root","password") or die(mysql_error());
mysql_select_db("belajar_sql",$koneksi) or die (mysql_error());
?>
NB : Pada Bagian Password isi sesuai yang anda buat :)
Pada Bagian "belajar_sql" ini maksudnya databases yang anda buat..!!
Coding/Listing Gambar 1.0 (Simpan Dengan input.php) :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<br /><br />
<form action="simpan.php" method="post">
<table width="331" border="2" cellspacing="0" cellpadding="0" align="center">
<tr>
<td colspan="2" align="center"><font face="Comic Sans MS"> Form Input Data DVD</font></td>
</tr>
<tr>
<td width="159"> Kode Transaksi</td>
<td width="164"> <input name="notrans" type="text" size="10" maxlength="10" /></td>
</tr>
<tr>
<td> Kode DVD</td>
<td> <select name="kddvd">
<option>--Click Here--</option>
<option value="D001">D001</option>
<option value="D002">D002</option>
<option value="D003">D003</option>
</select></td>
</tr>
<tr>
<td> Jumlah Beli</td>
<td> <input name="jumbel" type="text" size="5" maxlength="5" /></td>
</tr>
<tr>
<td colspan="2" align="center"> <input name="bsimpan" type="submit" value="Simpan" /> <input name="bcancel" type="reset" value="Batal" /></td>
</tr>
</table>
</form>
</body>
</html>
Coding/Listing Gambar 2.0 (Simpan Dengan Nama simpan.php) :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
include "koneksi.php";
$notrans=$_POST['notrans'];
if($kddvd=='D001')
{
$judul="Kambing Jantan";
$harga=50000;
}
elseif($kddvd=='D002')
{
$judul="Monster VS Alien";
$harga=40000;
}
else
{
$judul="New Moon";
$harga=30000;
}
$jumbel=$_POST['jumbel'];
$total=$harga*$jumbel;
$simpan=mysql_query("insert into dvd(notrans,kd_dvd,judul,harga,jumlah_beli,total) values ('$notrans','$kddvd','$judul','$harga','$jumbel','$total')",$koneksi) or die (mysql_error());
?>
Silakan Lihat Data<br />
<a href="tampil.php">Lihat</a>
</body>
</html>
Coding/Listing Gambar 3.0 (Simpan Dengan Nama tampil.php) :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<font size="4">Data DVD</font><br />
<?php
include "koneksi.php";
$query=mysql_query("select * from dvd",$koneksi);
$jumlah=mysql_num_rows($query);
echo "<pre>";
echo "<b><u>Jumlah DVD : $jumlah</u></b>";
while($baris=mysql_fetch_row($query))
{
echo "<br>";
echo "No Transaksi : $baris[0]<br>";
echo "Kode DVD : $baris[1]<br>";
echo "Judul : $baris[2]<br>";
echo "Harga : $baris[3]<br>";
echo "Jumlah Beli : $baris[4]<br>";
echo "Total : $baris[5]<br>";
echo "<br>";
}
echo "<p><a href=input.php>Back</a>";
echo "</pre>";
?>
</body>
</html>
Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com
atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :