Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "root";
- $password= "";
- $dbname = "inventory";
- $conn = new mysqli($servername, $username, $password, $dbname);
- if($conn->connect_error){
- die("Connection Failed:" . $conn->connect_error);
- }
- $bookid = $_POST['bookid'];
- $title = $_POST['title'];
- $author = $_POST['author'];
- $accountnumber = $_POST['accountnumber'];
- $callnumber = $_POST['callnumber'];
- $sql = "INSERT INTO data (bookid,title,author,accountnumber,callnumber,) VALUES ('$bookid', $title','$author',
- '$accountnumber','$callnumber')";
- if ($conn->query($sql) === TRUE) {
- $_session['comment']="Adding a new record successfully";
- header("Location:book.php");
- //echo "New record added successfully";
- } else{
- echo "Error: " .$sql . "<br>" . $conn->error;
- }
- $conn->close();
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>ADDING DATA</title>
- </head>
- <body>
- <form name="login" method="POST" action="book.php"><center>
- *ADD A NEW DATA*<br/>
- <a class='pull-left' href='home.php' style='text-decoration:none;'>back</a><br><br>
- TITLE: <input type= "text" placeholder ="Enter your name" name = "title" required><br/>
- AUTHOR: <input type= "text" placeholder ="Enter your address" name = "Author" required><br/>
- ACCOUNT NUMBER: <input type= "text" placeholder ="Enter your course" name = "AccountNumber" required><br/>
- CALL NUMBER: <input type= "text" placeholder ="Enter your birthdate" name = "CallNumber" required><br/>
- <input type= "submit" value = "ADD"></center>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement