本文整理汇总了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