My code is giving an error ( Undefined index: search_string) and I haven't found the solution, how can I sort that out please.
Code below.
<?php
include('studentheader.php');
include('booksdb.php'); //note we moved this line
if ($_POST) {
$title = $_POST['title'];
$stmt = $DBH->prepare("SELECT * from Books where book_title LIKE '%".$title."%' " );
$stmt->bindParam(1, $title);
$stmt->execute();
include('errordb.php');
header("Location: ");
}
?>
<h2>Search for a book</h2><br></br>
<form class='form-style' action="searchbook.php" method="post">
Title: <input type="text" name="title" value="<?php echo $title; ?>" />
<input type="submit" name="submit" value="Search" class='button'/>
</form>
<?php include('studentfooter.php'); ?>