Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "inventory";
- $conn = new mysqli ($servername, $username, $password, $dbname);
- if($conn->connect_error){
- die("Connection Failed:" . $conn->connect_error);
- }
- // (script post[""]) same sa = (name="" sa form)
- $bookid=$_POST['bookid'];
- $title=$_POST['title'];
- $author=$_POST['author'];
- $accountnumber=$_POST['accountnumber'];
- $callnumber=$_POST['callnumber'];
- $sql = mysqli_query("INSERT INTO data (bookid,title,author,accountnumber,callnumber)
- VALUES ('$_POST'['title']','$_POST'['author']','$_POST'['accountnumber']','$_POST'['callnumber]')");
- if ($conn->query($sql) === TRUE) {
- header("Location:add.php");
- }
- ?>
- <html>
- <head>
- <title>ADDING DATA</title>
- <style>
- label{display:inline-block;width:100px;margin-bottom:10px;}
- </style>
- </head>
- <body>
- <form method="post" action="book.php">
- <label>TITLE</label>
- <input type="text" name="title" />
- <br />
- <label>AUTHOR</label>
- <input type="text" name="author" />
- <br />
- <label>ACCOUNT NUMBER</label>
- <input type="text" name="accountnumber" />
- <br />
- <label>CALLNUMBER</label>
- <input type="text" name="callnumber" />
- <br />
- <input type="submit" value="Add Book">
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement