Latihan 9 - Aplikasi Pemrograman Web - Peminjaman Buku - Kombinasi Beberapa Tabel
Di Latihan 9 membahas pengoperasian aplikasi untuk mengolah dari beberapa tabel
<head>
<title>Aplikasi Buku Perpustakaan</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<table width=800 border=0 align=center>
<tr height=200 class="kotak5 gradient8">
<td>
<p align=left>
<font color=white size=6>
Aplikasi Buku Perpustakaan
</font>
</p>
</td>
</tr>
<tr height=50 class="kotak1 gradient7">
<td>
<div class="ketengah">
<!-- linear gradient -->
<?php
include "menu.php"
?>
</div>
</td>
</tr>
<tr height=200>
<td>
<image src="gambar/gerbang.jpg" width=800 height=300>
</td>
</tr>
<tr height=30 class="kotak3 gradient6">
<td>
<marquee scrollamount="4" onmouseover="this.stop()" onmouseout="this.start()" style="color: white;">
<font size="3"> <b>
Selamat Datang di Aplikasi Buku Perpustakaan SMKN 1 Panyingkiran
</b></font>
</marquee>
</td>
</tr>
<tr height=800 class="kotak4 gradient7" valign="top">
<td>
<br><br><br>
<center>
<font color=white size="4"><b>
PEMINJAMAN BUKU PERPUSTAKAAN
</font></b>
<br><br><br>
<?php
include "koneksi.php";
$kdbuku = $_GET['kdbuku'];
$query_mysql = mysql_query("SELECT * FROM buku WHERE kdbuku='$kdbuku'")or die(mysql_error());
$nomor = 1;
while($data = mysql_fetch_array($query_mysql)){
?>
<form action="buku-simpan-peminjaman.php" method="post">
<table align="center" width="700">
<tr bgcolor="lightgreen">
<td>id</td>
<td >
<input type="text" name="id">
</td>
</tr>
<tr bgcolor="lightgreen">
<td>Nama</td>
<td>
<input type="text" name="nama">
</td>
</tr>
<tr bgcolor="lightgreen">
<td>Tanggal Pinjam</td>
<td>
<input type="date" name="tglpinjam">
</td>
</tr>
<tr bgcolor="lightgreen">
<td>Tanggal Kembali</td>
<td>
<input type="date" name="tglkembali">
</td>
</tr>
<tr bgcolor="lightgreen">
<td>Keterangan</td>
<td>
<input type="text" name="ket" readonly value="<?php echo 'pinjam' ?>">
</td>
</tr>
<tr bgcolor="lightgreen">
<td>Kdbuku</td>
<td bgcolor="blue" >
<input type="text" name="kdbuku" readonly value="<?php echo $data['kdbuku'] ?>">
</td>
</tr>
<tr bgcolor="lightgreen">
<td>ISBN</td>
<td bgcolor="blue" ><input type="text" name="isbn" readonly value="<?php echo $data['isbn'] ?>"></td>
</tr>
<tr bgcolor="lightgreen">
<td>Judul</td>
<td><input type="text" name="judul" readonly value="<?php echo $data['judul'] ?>"></td>
</tr>
<tr bgcolor="lightgreen">
<td>Pengarang</td>
<td bgcolor="blue" ><input type="text" name="pengarang" readonly value="<?php echo $data['pengarang'] ?>"></td>
</tr>
<tr bgcolor="lightgreen">
<td>Penerbit</td>
<td bgcolor="blue" ><input type="text" name="penerbit" readonly value="<?php echo $data['penerbit'] ?>"></td>
</tr>
<tr bgcolor="lightgreen">
<td></td>
<td>
<Button class=warna2 type="submit" value="Simpan Data Peminjaman Buku">
< Simpan Data Peminjaman Buku >
</button>
</td>
</tr>
</table>
</form>
<?php } ?>
</td>
</tr>
<tr height=200 class="kotak2 gradient8">
<td>
<p align=center>
<img src="gambar/logo.png" width="50" height="50"><br>
<font color=white size="4">
SMK Negeri 1 Panyingkiran
</font>
<br>
<font color=white size="2">
Jalan Kirapandak Panyingkiran Kabupaten Majalengka 45459
<br>
Created By : muchamadekisa@2019
</font>
</p>
</td>
</tr>
</table>
</body>
<?php
include 'koneksi.php';
$id = $_POST['id'];
$tglpinjam = $_POST['tglpinjam'];
$kdbuku = $_POST['kdbuku'];
$tglkembali = $_POST['tglkembali'];
$nama = $_POST['nama'];
$isbn = $_POST['isbn'];
$judul = $_POST['judul'];
$pengarang = $_POST['pengarang'];
$penerbit = $_POST['penerbit'];
$ket = $_POST['ket'];
mysql_query("INSERT INTO peminjaman
VALUES('$id','$tglpinjam','$kdbuku','$tglkembali','$nama')");
mysql_query("UPDATE buku
SET isbn='$isbn', judul='$judul', pengarang='$pengarang', penerbit='$penerbit', ket='$ket' WHERE kdbuku='$kdbuku'");
header("location:buku-lihat.php");
?>
Di Latihan 9 membahas pengoperasian aplikasi untuk mengolah dari beberapa tabel
buku-pinjam.php
<head>
<title>Aplikasi Buku Perpustakaan</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<table width=800 border=0 align=center>
<tr height=200 class="kotak5 gradient8">
<td>
<p align=left>
<font color=white size=6>
Aplikasi Buku Perpustakaan
</font>
</p>
</td>
</tr>
<tr height=50 class="kotak1 gradient7">
<td>
<div class="ketengah">
<!-- linear gradient -->
<?php
include "menu.php"
?>
</div>
</td>
</tr>
<tr height=200>
<td>
<image src="gambar/gerbang.jpg" width=800 height=300>
</td>
</tr>
<tr height=30 class="kotak3 gradient6">
<td>
<marquee scrollamount="4" onmouseover="this.stop()" onmouseout="this.start()" style="color: white;">
<font size="3"> <b>
Selamat Datang di Aplikasi Buku Perpustakaan SMKN 1 Panyingkiran
</b></font>
</marquee>
</td>
</tr>
<tr height=800 class="kotak4 gradient7" valign="top">
<td>
<br><br><br>
<center>
<font color=white size="4"><b>
PEMINJAMAN BUKU PERPUSTAKAAN
</font></b>
<br><br><br>
<?php
include "koneksi.php";
$kdbuku = $_GET['kdbuku'];
$query_mysql = mysql_query("SELECT * FROM buku WHERE kdbuku='$kdbuku'")or die(mysql_error());
$nomor = 1;
while($data = mysql_fetch_array($query_mysql)){
?>
<form action="buku-simpan-peminjaman.php" method="post">
<table align="center" width="700">
<tr bgcolor="lightgreen">
<td>id</td>
<td >
<input type="text" name="id">
</td>
</tr>
<tr bgcolor="lightgreen">
<td>Nama</td>
<td>
<input type="text" name="nama">
</td>
</tr>
<tr bgcolor="lightgreen">
<td>Tanggal Pinjam</td>
<td>
<input type="date" name="tglpinjam">
</td>
</tr>
<tr bgcolor="lightgreen">
<td>Tanggal Kembali</td>
<td>
<input type="date" name="tglkembali">
</td>
</tr>
<tr bgcolor="lightgreen">
<td>Keterangan</td>
<td>
<input type="text" name="ket" readonly value="<?php echo 'pinjam' ?>">
</td>
</tr>
<tr bgcolor="lightgreen">
<td>Kdbuku</td>
<td bgcolor="blue" >
<input type="text" name="kdbuku" readonly value="<?php echo $data['kdbuku'] ?>">
</td>
</tr>
<tr bgcolor="lightgreen">
<td>ISBN</td>
<td bgcolor="blue" ><input type="text" name="isbn" readonly value="<?php echo $data['isbn'] ?>"></td>
</tr>
<tr bgcolor="lightgreen">
<td>Judul</td>
<td><input type="text" name="judul" readonly value="<?php echo $data['judul'] ?>"></td>
</tr>
<tr bgcolor="lightgreen">
<td>Pengarang</td>
<td bgcolor="blue" ><input type="text" name="pengarang" readonly value="<?php echo $data['pengarang'] ?>"></td>
</tr>
<tr bgcolor="lightgreen">
<td>Penerbit</td>
<td bgcolor="blue" ><input type="text" name="penerbit" readonly value="<?php echo $data['penerbit'] ?>"></td>
</tr>
<tr bgcolor="lightgreen">
<td></td>
<td>
<Button class=warna2 type="submit" value="Simpan Data Peminjaman Buku">
< Simpan Data Peminjaman Buku >
</button>
</td>
</tr>
</table>
</form>
<?php } ?>
</td>
</tr>
<tr height=200 class="kotak2 gradient8">
<td>
<p align=center>
<img src="gambar/logo.png" width="50" height="50"><br>
<font color=white size="4">
SMK Negeri 1 Panyingkiran
</font>
<br>
<font color=white size="2">
Jalan Kirapandak Panyingkiran Kabupaten Majalengka 45459
<br>
Created By : muchamadekisa@2019
</font>
</p>
</td>
</tr>
</table>
</body>
buku-simpan-peminjaman.php
<?php
include 'koneksi.php';
$id = $_POST['id'];
$tglpinjam = $_POST['tglpinjam'];
$kdbuku = $_POST['kdbuku'];
$tglkembali = $_POST['tglkembali'];
$nama = $_POST['nama'];
$isbn = $_POST['isbn'];
$judul = $_POST['judul'];
$pengarang = $_POST['pengarang'];
$penerbit = $_POST['penerbit'];
$ket = $_POST['ket'];
mysql_query("INSERT INTO peminjaman
VALUES('$id','$tglpinjam','$kdbuku','$tglkembali','$nama')");
mysql_query("UPDATE buku
SET isbn='$isbn', judul='$judul', pengarang='$pengarang', penerbit='$penerbit', ket='$ket' WHERE kdbuku='$kdbuku'");
header("location:buku-lihat.php");
?>
Tidak ada komentar:
Posting Komentar