Sistem perpustakaan ini memungkinkan pengguna untuk menambah, meminjam, dan mengembalikan buku. Halaman utama (index.php
) memiliki tiga bagian utama:
Tambah Buku:
<form id="addBookForm" method="post">
<div class="form-group">
<label for="title">Judul:</label>
<input type="text" class="form-control" id="title" name="title">
</div>
<div class="form-group">
<label for="author">Penulis:</label>
<input type="text" class="form-control" id="author" name="author">
</div>
<div class="form-group">
<label for="publicationYear">Tahun Terbit:</label>
<input type="text" class="form-control" id="publicationYear" name="publicationYear">
</div>
<button type="submit" class="btn btn-primary" name="addBook">Tambah Buku</button>
</form>
Pinjam Buku:
<form id="borrowBookForm" method="post">
<div class="form-group">
<label for="borrowTitle">Judul Buku:</label>
<select class="form-control" id="borrowTitle" name="borrowTitle">
<option value="" selected disabled>Pilih Judul Buku</option>
<?php
foreach ($_SESSION['availableBooks'] as $book) {
if (!$book['isBorrowed']) {
echo "<option value='{$book['title']}'>{$book['title']}</option>";
}
}
?>
</select>
</div>
<button type="submit" class="btn btn-primary" name="borrowBook">Pinjam Buku</button>
</form>
Pengembalian Buku:
<form id="returnBookForm" method="post">
<div class="form-group">
<label for="returnTitle">Judul Buku:</label>
<select class="form-control" id="returnTitle" name="returnTitle">
<option value="" selected disabled>Pilih Judul Buku</option>
<?php
foreach ($_SESSION['availableBooks'] as $book) {
if ($book['isBorrowed']) {
echo "<option value='{$book['title']}'>{$book['title']}</option>";
}
}
?>
</select>
</div>
<button type="submit" class="btn btn-primary" name="returnBook">Kembalikan Buku</button>
</form>