I have two tables: book
and borrowed_books
.
Book
Table has book_ID | Book Name
Borrowed_Books
has student_ID | Book Name
The Book names from both tables are Indexed.
I added the values of Book Table into an HTML Form select/option and it is being read but the problem is when I'm trying to insert the value, it's not reading the option name or value.
HTML:
<select id="heard" class="form-control">
<option value="">Choose Book</option>
<?php require_once '../mysql/bookssql.php';
while($row = mysqli_fetch_array($data, MYSQLI_ASSOC)){
echo '<option name="borrow_book" value="'.$row['Title'].'">' .$row['Title']. '</option>';
}
?>
</select>
PHP Insert Code:
<?php $borrow_book = $_POST['borrow_book'];
$upload = "INSERT INTO `borrowed_books` (`student_ID`, `Book Name`) VALUES ('23, '$borrow_book');";
?>