<b>BOOK ISBN: </b><input type="text" name="INPUT_BISBN"><br> <br> <input type="submit" name="BOOK_ADDBTN" value="ADD BOOK"><br> </form> '; //ARRAY OF ALLOWED GENRES $ALLOWED_GENRES = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18); //IF BUTTON PRESSED if (isset($_POST['BOOK_ADDBTN'])) { //CHECK FIELDS if (isset($_POST['INPUT_BNAME']) and isset($_POST['INPUT_BAUTHOR']) and isset($_POST['INPUT_BGENRE']) and isset($_POST['INPUT_BISBN'])) { //CHECK FOR ALLOWED GENRES if (in_array($_POST['INPUT_BGENRE'], $ALLOWED_GENRES)) { $BOOK_INPUTS = array('NAME' => $_POST['INPUT_BNAME'], 'AUTHOR' => $_POST['INPUT_BAUTHOR'], 'GENRE' => $_POST['INPUT_BGENRE'], 'UNIQ' => uniqid(rand(1, 99999) . rand(1, 99999), true), 'ISBN' => $_POST['INPUT_BISBN']); //EXECUTE ADDBOOK FUNCTION if (addbook($BOOK_INPUTS['NAME'], $BOOK_INPUTS['AUTHOR'], $BOOK_INPUTS['GENRE'], $BOOK_INPUTS['ISBN']) === true) { echo 'ADDITION OF ' . $BOOK_INPUTS['NAME'] . ' WAS SUCESSFUL'; } else { echo 'ADDITION OF <b>' . $BOOK_INPUTS['NAME'] . '</b> WAS NOT SUCESSFUL'; } } else { echo 'FORM ERROR'; $ADDBOOK_QUERY->close(); } } else { echo 'FORM ERROR'; $ADDBOOK_QUERY->close(); } } echo '</center>'; } elseif ($_GET['page'] == '3') {
<?php include '../includes/config.php'; if ($_SERVER["REQUEST_METHOD"] == "POST") { $bookid = $_POST["book"]; $price = $_POST["price"]; addbook($bookid, $price); render("thanks.php", ["message" => "Thankyou for letting us know"]); } else { redirect("/"); }