本文整理匯總了PHP中Library::insertBook方法的典型用法代碼示例。如果您正苦於以下問題:PHP Library::insertBook方法的具體用法?PHP Library::insertBook怎麽用?PHP Library::insertBook使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Library
的用法示例。
在下文中一共展示了Library::insertBook方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: elseif
include "add.html";
} elseif (isset($_POST["search"])) {
// user wants to search the database: show search form
include "search.html";
} elseif (isset($_POST["addBook"])) {
// add a book to the database
if (empty($_POST["author"]) || empty($_POST["title"]) || empty($_POST["genre"])) {
// check if all fields are used, if not, tell user
echo "<br /><b>You need to fill in all the fields!</b>";
} else {
// set variables
$author = $_POST["author"];
$title = $_POST["title"];
$genre = $_POST["genre"];
// insert book into database
$library->insertBook($author, $title, $genre);
}
} elseif (isset($_POST["startAuthorSearch"])) {
// search on author
$author = $_POST["authorSearch"];
$library->searchAuthor($author);
} elseif (isset($_POST["startTitleSearch"])) {
// 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