<script src="js/bootstrap.min.js"></script>
            </head>
            <body>
            <div class="container">
            <h2>Ubah Data Buku</h2>
            <form action="edit.php" method="POST" class="form-group">
            Kode Buku: <input type="text" name="no_data" value="' . $edit->no_data . '" class="form-control"><br>
            Judul Buku: <input type="text" name="nama" value="' . $edit->nama_data . '" class="form-control"><br>
            Pengarang Buku: <input type="text" name="matkul" value="' . $edit->mata_kuliah . '" class="form-control"><br>
            Penerbit Buku: <input type="text" name="semester" value="' . $edit->semester . '" class="form-control"><br>
            <input type="submit" name="updateBook" value="Update" class="btn btn-info">
            </form>
            </div>
            </body>
            </html>
            ';
}
if (isset($_POST['updateBook'])) {
    $kode = $_POST['no_data'];
    $judul = $_POST['nama'];
    $pengarang = $_POST['matkul'];
    $penerbit = $_POST['semester'];
    $Lib = new Library();
    $upd = $Lib->updateBook($no_data, $nama, $matkul, $semester);
    if ($upd == "Success") {
        header('Location: list.php');
    }
}
?>
    </body>
</html>
Esempio n. 2
0
        // search on title
        $title = $_POST["titleSearch"];
        $library->searchTitle($title);
    } elseif (isset($_POST["startGenreSearch"])) {
        // search on genre
        $genre = $_POST["genreSearch"];
        $library->searchGenre($genre);
    } elseif (isset($_POST["updateBook"])) {
        // user wants to update a book: show update form
        $ident = $_POST["ident"];
        $library->setIdent($ident);
        include "update.php";
    } elseif (isset($_POST["update"])) {
        // update the book
        $ident = $_POST["ident"];
        $author = $_POST["author"];
        $title = $_POST["title"];
        $genre = $_POST["genre"];
        $library->updateBook($ident, $author, $title, $genre);
    }
}
?>
        </div>
        
        <div id="images">
            <img src="images/fantasylibrary3.jpg" alt="Library"/>
        </div>
                    
    </body>
</html>