<?php
$dbh = new PDO("mysql:host=localhost;dbname=books", "root", "");

if ($_POST['submit'] == 'insert'){
   $title = $_POST['title'];
   $author = $_POST['author'];
   $isbn = $_POST['isbn'];
   $price = $_POST['price'];
   $dateofpublish =$_POST['dateofpublish'];
   $sql = $dbh->prepare("insert into books (title,author,isbn,price,dateofpublish) values ('$title','$author','$isbn','$price','$dateofpublish')");    
   $sql->execute();    
   echo "Record Inserted!";
    
    
    
}
//get values from the form
//insert
//output a response


?>



<form action = "books.php" method = "post">
Title  <input type="text" name="title"><br> 
Author <input type="text" name="author"><br> 
ISBN  <input type="text" name="isbn"><br> 
Price  <input type="text" name="price"><br> 
Date of Publish  <input type="text" name="dateofpublish"><br> 
<input type="submit" name="submit" value="insert">
</form>