Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <!-- Required meta tags -->
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <!-- Font Awesome -->
- <link rel="stylesheet" href="font-awesome/css/font-awesome.css">
- <!-- Bootstrap CSS -->
- <link rel="stylesheet" href="css/bootstrap.min.css">
- <link rel="stylesheet" href="w3.css">
- </head>
- <body>
- <table class="table">
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "library";
- // Create connection
- $conn = mysqli_connect($servername, $username, $password, $dbname);
- // Check connection
- if (!$conn) {
- die("Connection failed: " . mysqli_connect_error());
- }
- $search_value = $_POST['search'];
- $sql = "SELECT * FROM books WHERE Title LIKE '%$search_value%'";
- $result = mysqli_query($conn, $sql);
- if (mysqli_num_rows($result) > 0) {
- echo "<thead><tr><th>ISBN</th><th>Publisher_ID</th><th>Title</th><th>Author</th><th>Rack No</th><th>No_of_books</th><th>Date of Purchase</th><th>No Available</th><th>Category ID</th></tr></thead>";
- // output data of each row
- while ($row = mysqli_fetch_assoc($result)) {
- echo "<tbody><tr><td>" . $row["ISBN"] . "</td><td>" . $row["Publisher_ID"] . "</td><td><button type=\"button\" class=\"btn btn-secondary\" data-toggle=\"modal\" data-target=\"#Model\">" . $row["Title"] . " </button></td><td>" . $row["Author"] . "</td><td>" . $row["Rack_No"] . "</td><td>" . $row["No_of_books"] . "</td><td>" . $row["Date_of_Purchase"] . "</td><td>" . $row["No_Available"] . "</td><td>" . $row["Category_ID"] . "</td></tr></tbody>";
- }
- echo "</table>";
- } else {
- echo "0 results";
- }
- mysqli_close($conn);
- ?>
- <!-- Modal -->
- <div class="modal fade" id="Model" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitle" aria-hidden="true">
- <div class="modal-dialog" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title" id="exampleModalLongTitle">Modal title</h5>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true">×</span>
- </button>
- </div>
- <div class="modal-body">
- <form class="w3-container" action="/action_page.php">
- <div class="w3-section">
- <label><b>ISBN</b></label>
- <input class="w3-input w3-border w3-margin-bottom" type="text1" placeholder="Enter ISBN" name="usrname" required>
- <label><b>Title</b></label>
- <input class="w3-input w3-border w3-margin-bottom" type="text1" placeholder="Enter Book Title" name="usrname" required>
- <label><b>Author</b></label>
- <input class="w3-input w3-border w3-margin-bottom" type="text1" placeholder="Enter Book Author" name="usrname" required>
- <label><b>Publisher ID</b></label>
- <input class="w3-input w3-border w3-margin-bottom" type="text1" placeholder="Enter Publisher ID" name="usrname" required>
- <label><b>Rack No.</b></label>
- <input class="w3-input w3-border w3-margin-bottom" type="text1" placeholder="Enter Rack No." name="usrname" required>
- <label><b>No. Of Books</b></label>
- <input class="w3-input w3-border w3-margin-bottom" type="text1" placeholder="Enter No. Of Books" name="usrname" required>
- <button class="w3-button w3-block w3-green w3-section w3-padding" type="submit">Update</button>
- </div>
- </form>
- <form class="w3-container" action="/action_page.php">
- <div class="w3-section">
- <button class="w3-button w3-block w3-green w3-section w3-padding" type="submit">Delete</button>
- </div>
- </form>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
- </div>
- </div>
- </div>
- </div>
- <!-- Optional JavaScript -->
- <!-- jQuery first, then Popper.js, then Bootstrap JS -->
- <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
- <script src="js/bootstrap.min.js"></script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement