Step 4 Creation of Add/Manage Book Module

This is how Add/Manage Books will look like:

Add book page


Manage Book Page


Books Database


Features:

  • Admin can add a new book using its details.
  • Admin can edit the details of existing books.
  • All changes will be reflected on our SQL database.

Code:

Below is the code for modules mentioned above:

add_book.php
<?php
    require("functions.php");
    session_start();
    #fetch data from database
    $connection = mysqli_connect("localhost","root","");
    $db = mysqli_select_db($connection,"lms");
    $name = "";
    $email = "";
    $mobile = "";
    $query = "select * from admins where email = '$_SESSION[email]'";
    $query_run = mysqli_query($connection,$query);
    while ($row = mysqli_fetch_assoc($query_run)){
        $name = $row['name'];
        $email = $row['email'];
        $mobile = $row['mobile'];
    }
?>
<!DOCTYPE html>
<html>
<head>
    <title>Add New Book</title>
    <meta charset="utf-8" name="viewport" content="width=device-width,intial-scale=1">
    <link rel="stylesheet" type="text/css" href="../bootstrap-4.4.1/css/bootstrap.min.css">
      <script type="text/javascript" src="../bootstrap-4.4.1/js/juqery_latest.js"></script>
      <script type="text/javascript" src="../bootstrap-4.4.1/js/bootstrap.min.js"></script>
      <script type="text/javascript">
          function alertMsg(){
              alert(Book added successfully...);
              window.location.href = "admin_dashboard.php";
          }
      </script>
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container-fluid">
            <div class="navbar-header">
                <a class="navbar-brand" href="admin_dashboard.php">Library Management System (LMS)</a>
            </div>
            <font style="color: white"><span><strong>Welcome: <?php echo $_SESSION['name'];?></strong></span></font>
            <font style="color: white"><span><strong>Email: <?php echo $_SESSION['email'];?></strong></font>
            <ul class="nav navbar-nav navbar-right">
              <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" data-toggle="dropdown">My Profile </a>
                <div class="dropdown-menu">
                    <a class="dropdown-item" href="">View Profile</a>
                    <div class="dropdown-divider"></div>
                    <a class="dropdown-item" href="#">Edit Profile</a>
                    <div class="dropdown-divider"></div>
                    <a class="dropdown-item" href="change_password.php">Change Password</a>
                </div>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="../logout.php">Logout</a>
              </li>
            </ul>
        </div>
    </nav><br>
    <nav class="navbar navbar-expand-lg navbar-light" style="background-color: #e3f2fd">
        <div class="container-fluid">
            
            <ul class="nav navbar-nav navbar-center">
              <li class="nav-item">
                <a class="nav-link" href="admin_dashboard.php">Dashboard</a>
              </li>
              <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" data-toggle="dropdown">Books </a>
                <div class="dropdown-menu">
                    <a class="dropdown-item" href="add_book.php">Add New Book</a>
                    <div class="dropdown-divider"></div>
                    <a class="dropdown-item" href="manage_book.php">Manage Books</a>
                </div>
              </li>
              <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" data-toggle="dropdown">Category </a>
                <div class="dropdown-menu">
                    <a class="dropdown-item" href="add_cat.php">Add New Category</a>
                    <div class="dropdown-divider"></div>
                    <a class="dropdown-item" href="manage_cat.php">Manage Category</a>
                </div>
              </li>
              <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" data-toggle="dropdown">Authors</a>
                <div class="dropdown-menu">
                    <a class="dropdown-item" href="add_author.php">Add New Author</a>
                    <div class="dropdown-divider"></div>
                    <a class="dropdown-item" href="manage_author.php">Manage Author</a>
                </div>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="issue_book.php">Issue Book</a>
              </li>
            </ul>
        </div>
    </nav><br>
    <center><h4>Add a new Book</h4><br></center>
        <div class="row">
            <div class="col-md-4"></div>
            <div class="col-md-4">
                <form action="" method="post">
                    <div class="form-group">
                        <label for="email">Book Name:</label>
                        <input type="text" name="book_name" class="form-control" required>
                    </div>
                    <div class="form-group">
                        <label for="mobile">Author ID:</label>
                        <input type="text" name="book_author" class="form-control" required>
                    </div>
                    <div class="form-group">
                        <label for="mobile">Category ID:</label>
                        <input type="text" name="book_category" class="form-control" required>
                    </div>
                    <div class="form-group">
                        <label for="mobile">Book Number:</label>
                        <input type="text" name="book_no" class="form-control" required>
                    </div>
                    <div class="form-group">
                        <label for="mobile">Book Price:</label>
                        <input type="text" name="book_price" class="form-control" required>
                    </div>
                    <button type="submit" name="add_book" class="btn btn-primary">Add Book</button>
                </form>
            </div>
            <div class="col-md-4"></div>
        </div>
</body>
</html>

<?php
    if(isset($_POST['add_book']))
    {
        $connection = mysqli_connect("localhost","root","");
        $db = mysqli_select_db($connection,"lms");
        $query = "insert into books values(null,'$_POST[book_name]','$_POST[book_author]','$_POST[book_category]',$_POST[book_no],$_POST[book_price])";
        $query_run = mysqli_query($connection,$query);
        #header("location:add_book.php");
    }
?>
manage_book.php
<?php
    require("functions.php");
    session_start();
    #fetch data from database
    $connection = mysqli_connect("localhost","root","");
    $db = mysqli_select_db($connection,"lms");
    $name = "";
    $email = "";
    $mobile = "";
    $query = "select * from admins where email = '$_SESSION[email]'";
    $query_run = mysqli_query($connection,$query);
    while ($row = mysqli_fetch_assoc($query_run)){
        $name = $row['name'];
        $email = $row['email'];
        $mobile = $row['mobile'];
    }
?>
<!DOCTYPE html>
<html>
<head>
    <title>Manage Book</title>
    <meta charset="utf-8" name="viewport" content="width=device-width,intial-scale=1">
    <link rel="stylesheet" type="text/css" href="../bootstrap-4.4.1/css/bootstrap.min.css">
      <script type="text/javascript" src="../bootstrap-4.4.1/js/juqery_latest.js"></script>
      <script type="text/javascript" src="../bootstrap-4.4.1/js/bootstrap.min.js"></script>
      <script type="text/javascript">
          function alertMsg(){
              alert(Book added successfully...);
              window.location.href = "admin_dashboard.php";
          }
      </script>
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container-fluid">
            <div class="navbar-header">
                <a class="navbar-brand" href="admin_dashboard.php">Library Management System (LMS)</a>
            </div>
            <font style="color: white"><span><strong>Welcome: <?php echo $_SESSION['name'];?></strong></span></font>
            <font style="color: white"><span><strong>Email: <?php echo $_SESSION['email'];?></strong></font>
            <ul class="nav navbar-nav navbar-right">
              <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" data-toggle="dropdown">My Profile </a>
                <div class="dropdown-menu">
                    <a class="dropdown-item" href="">View Profile</a>
                    <div class="dropdown-divider"></div>
                    <a class="dropdown-item" href="#">Edit Profile</a>
                    <div class="dropdown-divider"></div>
                    <a class="dropdown-item" href="change_password.php">Change Password</a>
                </div>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="../logout.php">Logout</a>
              </li>
            </ul>
        </div>
    </nav><br>
    <nav class="navbar navbar-expand-lg navbar-light" style="background-color: #e3f2fd">
        <div class="container-fluid">
            
            <ul class="nav navbar-nav navbar-center">
              <li class="nav-item">
                <a class="nav-link" href="admin_dashboard.php">Dashboard</a>
              </li>
              <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" data-toggle="dropdown">Books </a>
                <div class="dropdown-menu">
                    <a class="dropdown-item" href="add_book.php">Add New Book</a>
                    <div class="dropdown-divider"></div>
                    <a class="dropdown-item" href="manage_book.php">Manage Books</a>
                </div>
              </li>
              <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" data-toggle="dropdown">Category </a>
                <div class="dropdown-menu">
                    <a class="dropdown-item" href="add_cat.php">Add New Category</a>
                    <div class="dropdown-divider"></div>
                    <a class="dropdown-item" href="manage_cat.php">Manage Category</a>
                </div>
              </li>
              <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" data-toggle="dropdown">Authors</a>
                <div class="dropdown-menu">
                    <a class="dropdown-item" href="add_author.php">Add New Author</a>
                    <div class="dropdown-divider"></div>
                    <a class="dropdown-item" href="manage_author.php">Manage Author</a>
                </div>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="issue_book.php">Issue Book</a>
              </li>
            </ul>
        </div>
    </nav><br>
    <center><h4>Manage Books</h4><br></center>
        <div class="row">
            <div class="col-md-2"></div>
            <div class="col-md-8">
                <table class="table table-bordered table-hover">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Author</th>
                            <th>Category</th>
                            <th>ISBN No.</th>
                            <th>Price</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <?php
                        $connection = mysqli_connect("localhost","root","");
                        $db = mysqli_select_db($connection,"lms");
                        $query = "select * from books";
                        $query_run = mysqli_query($connection,$query);
                        while ($row = mysqli_fetch_assoc($query_run)){
                            ?>
                            <tr>
                                <td><?php echo $row['book_name'];?></td>
                                <td><?php echo $row['author_id'];?></td>
                                <td><?php echo $row['cat_id'];?></td>
                                <td><?php echo $row['book_no'];?></td>
                                <td><?php echo $row['book_price'];?></td>
                                <td><button class="btn" name=""><a href="edit_book.php?bn=<?php echo $row['book_no'];?>">Edit</a></button>
                                <button class="btn"><a href="delete_book.php?bn=<?php echo $row['book_no'];?>">Delete</a></button></td>
                            </tr>
                            <?php
                        }
                    ?>
                </table>
            </div>
            <div class="col-md-2"></div>
        </div>
</body>
</html>
edit_book.php
<?php
    session_start();
    #fetch data from database
    $connection = mysqli_connect("localhost","root","");
    $db = mysqli_select_db($connection,"lms");
    $book_name = "";
    $book_no = "";
    $author_id = "";
    $cat_id = "";
    $book_price = "";
    $query = "select * from books where book_no = $_GET[bn]";
    $query_run = mysqli_query($connection,$query);
    while ($row = mysqli_fetch_assoc($query_run)){
        $book_name = $row['book_name'];
        $book_no = $row['book_no'];
        $author_id = $row['author_id'];
        $cat_id = $row['cat_id'];
        $book_price = $row['book_price'];
    }
?>
<!DOCTYPE html>
<html>
<head>
    <title>Dashboard</title>
    <meta charset="utf-8" name="viewport" content="width=device-width,intial-scale=1">
    <link rel="stylesheet" type="text/css" href="../bootstrap-4.4.1/css/bootstrap.min.css">
      <script type="text/javascript" src="../bootstrap-4.4.1/js/juqery_latest.js"></script>
      <script type="text/javascript" src="../bootstrap-4.4.1/js/bootstrap.min.js"></script>
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container-fluid">
            <div class="navbar-header">
                <a class="navbar-brand" href="admin_dashboard.php">Library Management System (LMS)</a>
            </div>
            <font style="color: white"><span><strong>Welcome: <?php echo $_SESSION['name'];?></strong></span></font>
            <font style="color: white"><span><strong>Email: <?php echo $_SESSION['email'];?></strong></font>
            <ul class="nav navbar-nav navbar-right">
              <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" data-toggle="dropdown">My Profile </a>
                <div class="dropdown-menu">
                    <a class="dropdown-item" href="">View Profile</a>
                    <div class="dropdown-divider"></div>
                    <a class="dropdown-item" href="#">Edit Profile</a>
                    <div class="dropdown-divider"></div>
                    <a class="dropdown-item" href="change_password.php">Change Password</a>
                </div>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="../logout.php">Logout</a>
              </li>
            </ul>
        </div>
    </nav><br>
    <center><h4>Edit Book</h4><br></center>
        <div class="row">
            <div class="col-md-4"></div>
            <div class="col-md-4">
                <form action="" method="post">
                    <div class="form-group">
                        <label for="mobile">Book Number:</label>
                        <input type="text" name="book_no" value="<?php echo $book_no;?>" class="form-control" disabled required>
                    </div>
                    <div class="form-group">
                        <label for="email">Book Name:</label>
                        <input type="text" name="book_name" value="<?php echo $book_name;?>" class="form-control" required>
                    </div>
                    <div class="form-group">
                        <label for="mobile">Author ID:</label>
                        <input type="text" name="author_id" value="<?php echo $author_id;?>" class="form-control" required>
                    </div>
                    <div class="form-group">
                        <label for="mobile">Category ID:</label>
                        <input type="text" name="cat_id" value="<?php echo $cat_id;?>" class="form-control" required>
                    </div>
                    <div class="form-group">
                        <label for="mobile">Book Price:</label>
                        <input type="text" name="book_price" value="<?php echo $book_price;?>" class="form-control" required>
                    </div>
                    <button type="submit" name="update" class="btn btn-primary">Update Book</button>
                </form>
            </div>
            <div class="col-md-4"></div>
        </div>
</body>
</html>
<?php
    if(isset($_POST['update'])){
        $connection = mysqli_connect("localhost","root","");
        $db = mysqli_select_db($connection,"lms");
        $query = "update books set book_name = '$_POST[book_name]',author_id = $_POST[author_id],cat_id = $_POST[cat_id],book_price = $_POST[book_price] where book_no = $_GET[bn]";
        $query_run = mysqli_query($connection,$query);
        header("location:manage_book.php");
    }
?>
registered_book.php
<?php
    $connection = mysqli_connect("localhost","root","");
    $db = mysqli_select_db($connection,"lms");
    $book_count = 0;
    $query = "select count(*) as book_count from books";
    $query_run = mysqli_query($connection,$query);
    while ($row = mysqli_fetch_assoc($query_run)){
        $book_count = $row['book_count'];
    }
?>
Regbooks.php
<?php
    session_start();
    #fetch data from database
    $connection = mysqli_connect("localhost","root","");
    $db = mysqli_select_db($connection,"lms");
    $book_name = "";
    $author = "";
    $category = "";
    $book_no = "";
    $price = "";
    $query = "select books.book_name,books.book_no,book_price,authors.author_name from books left join authors on books.author_id = authors.author_id";
?>
<!DOCTYPE html>
<html>
<head>
    <title>All Reg Books</title>
    <meta charset="utf-8" name="viewport" content="width=device-width,intial-scale=1">
    <link rel="stylesheet" type="text/css" href="../bootstrap-4.4.1/css/bootstrap.min.css">
      <script type="text/javascript" src="../bootstrap-4.4.1/js/juqery_latest.js"></script>
      <script type="text/javascript" src="../bootstrap-4.4.1/js/bootstrap.min.js"></script>
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container-fluid">
            <div class="navbar-header">
                <a class="navbar-brand" href="admin_dashboard.php">Library Management System (LMS)</a>
            </div>
            <font style="color: white"><span><strong>Welcome: <?php echo $_SESSION['name'];?></strong></span></font>
            <font style="color: white"><span><strong>Email: <?php echo $_SESSION['email'];?></strong></font>
            <ul class="nav navbar-nav navbar-right">
              <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" data-toggle="dropdown">My Profile </a>
                <div class="dropdown-menu">
                    <a class="dropdown-item" href="#">View Profile</a>
                    <div class="dropdown-divider"></div>
                    <a class="dropdown-item" href="#">Edit Profile</a>
                    <div class="dropdown-divider"></div>
                    <a class="dropdown-item" href="change_password.php">Change Password</a>
                </div>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="../logout.php">Logout</a>
              </li>
            </ul>
        </div>
    </nav><br>
              <center><h4>Registered Book's Detail</h4><br></center>
        <div class="row">
            <div class="col-md-2"></div>
            <div class="col-md-8">
                <form>
                    <table class="table-bordered" width="900px" style="text-align: center">
                        <tr>
                            <th>Name</th>
                            <th>Author</th>
                            <th>Price</th>
                            <th>Number</th>
                        </tr>
                
                    <?php
                        $query_run = mysqli_query($connection,$query);
                        while ($row = mysqli_fetch_assoc($query_run)){
                            ?>
                            <tr>
                            <td><?php echo $row['book_name'];?></td>
                            <td><?php echo $row['author_name'];?></td>
                            <td><?php echo $row['book_price'];?></td>
                            <td><?php echo $row['book_no'];?></td>
                        </tr>

                    <?php
                        }
                    ?>    
                </table>
                </form>
            </div>
            <div class="col-md-2"></div>
        </div>
</body>
</html>
delete_book.php
<?php
    $connection = mysqli_connect("localhost","root","");
    $db = mysqli_select_db($connection,"lms");
    $query = "delete from books where book_no = $_GET[bn]";
    $query_run = mysqli_query($connection,$query);
?>
<script type="text/javascript">
    alert("Book Deleted successfully...");
    window.location.href = "manage_book.php";
</script>

Library Management System Project | Software Development

Library Management System is one of the most common software development projects till date. In this article, we are going to make the Library Management System software development project, from scratch, for final year students. We will be covering all the steps you have to do while developing this project.

Library Management System | Software Development Project

Similar Reads

How to create a Library Management System Project?

Table of Content How to create a Library Management System Project?Step 1- Team Formation Phase: Creating a Dynamic TeamStep 2- Topic SelectionStep 3- Project Synopsys for Library Management SystemStep 4- Requirement Gathering (Creating SRS for Library Mangement System)Software Requirement Specification (SRS) Document Template4.1 SRS (Library Mangement System) | Introduction:4.2 SRS (Library Mangement System) | Overall Description:4.3 SRS (Library Mangement System) | Designing Library Management System :4.3.1 Use case Diagram for Library Management System:4.3.2 ER Model of Library Management System:4.3.3 Data Flow Diagram of Library Management System:4.4 Functional Requirements | SRS (Library Mangement System) 4.5 Non Functional Requirements | SRS (Library Mangement System)4.6 SRS (Library Mangement System) | Appendices:5. Coding or Implementation of Library Mangement System 5.1 Implementing Library Mangement System | Environment Creation:5.2 Implementing Library Mangement System | Database Creation:5.3 Implementing Library Mangement System | Frontend and Backend Development:5.3.1 Step 1: Creation of Login page Module:5.3.2 Step 2: Creation of User Dashboard Module:5.3.3 Step 3: Creation of Admin Dashboard Module:5.3.4 Step 4: Creation of Add/Manage Book Module: 5.3.5 Step 5: Creation of Add/Manage Book Category Module: 5.3.6 Step 6: Creation of Issue Book Module: Step 6- Testing Library Mangement SystemStep 7- Creating Project Presentation on Library Management System:Step 8- Writing a Research Paper on Library Management System:Future Enhancements for Library Management System...

Step 1- Team Formation Phase: Creating a Dynamic Team

Team formation for a final year project is a crucial aspect that can significantly impact the success and efficiency of the project. In the final year, students often have diverse academic backgrounds, skills, and interests. Therefore, forming a well-balanced team becomes essential to leverage the strengths of each member and address any potential weaknesses....

Step 2- Topic Selection

While making our library management system project this will be our second step in which we will find an interesting problem statement and try to generate an idea to solve that problem using our knowledge....

Step 3- Synopsys for Library Management System Project

A project synopsis serves as a concise overview or summary of a proposed project, offering a brief but comprehensive insight into its objectives, scope, methodology, and expected outcomes. It typically acts as a preliminary document, providing supervisors, or evaluators with a quick understanding of the project before they delve into more detailed documentation....

Step 4- Requirement Gathering (Creating SRS for Library Management System)

This is the next phase after the submission of the synopsis report. We can do this process before the Synopsys report creation as well , It is all depends upon the project and their requirements. Here after getting an overview about the project now we can easily do the requirement gathering for our project....

Software Requirement Specification (SRS) Document | Library Management System Project

Below are some of the key points in a Software Requirement Specification Document:...

4.1 SRS (Library Management System) | Introduction:

4.1.1 Purpose:...

4.2 SRS (Library Management System) | Overall Description:

4.2.1 Product Perspective:...

4.3 SRS (Library Mangement System) | Designing Library Management System Project:

Use case Diagram for Library Management System Project:...

Use case Diagram for Library Management System Project:

Use Case Diagram of Library Management System Project...

ER Model of Library Management System Project:

ER Diagram is known as Entity-Relationship Diagram, it is used to analyze  the structure of the Database. It shows relationships between entities and their attributes. An ER Model provides a means of communication....

Data Flow Diagram of Library Management System Project:

Data Flow Diagram (DFD) serves as a visual representation of the flow of information within the system. This diagram illustrates how data, such as book information, user details, and transaction records, moves between various components of the LMS....

4.4 Functional Requirements | SRS (Library Management System)

The LMS must have the following functional requirements:...

4.5 Non Functional Requirements | SRS (Library Mangement System)

4.5.1 Usability Requirements:...

4.6 SRS (Library Management System) | Appendices:

Appendix A:...

5. Coding or Implementation of Library Management System

At this stage, the fundamental development of the product starts. For this, developers use a specific programming code as per the design. Hence, it is important for the coders to follow the protocols set by the association. Conventional programming tools like compilers, interpreters, debuggers, etc. are also put into use at this stage....

Implementing Library Mangement System | Environment Creation:

Required Softwares:...

Implementing Library Mangement System | Database Creation:

Go to your favourite browser and write localhost/dashboard >> phpmyadmin...

Implementing Library Mangement System | Frontend and Backend Development:

Now we are going to develop our frontend and backend part of the project in different modules....

Step 1: Creation of Login page Module:

This is how Our Landing page will look like:...

Step 2: Creation of User Dashboard Module:

This is how user dashboard will look like:...

Step 3: Creation of Admin Dashboard Module:

This is how our admin dashboard will look like:...

Step 4: Creation of Add/Manage Book Module:

This is how Add/Manage Books will look like:...

Step 5: Creation of Add/Manage Book Category Module:

This is how Add/Manage Book Category will look like:...

Step 6: Creation of Issue Book Module:

This is how Issue Book Page will look like:...

Step 6- Testing Library Mangement System

Testing is a crucial phase in the development of a library management system (LMS) to ensure that it meets its intended requirements, functions correctly, and is free of bugs. Below are some key steps and considerations for the testing phase of a library management system:...

Step 7- Creating Project Presentation on Library Management System:

In this phase of software development, Team will have to present their work in front of authorities and they will judge your work and give suggestions on the improvement areas. Please make sure to host your web project before this step to make a good impression on the judges and authorities....

Step 8- Writing a Research Paper on Library Management System Project:

You can also write a research paper on the basis of your work . The Research paper will explore the significance of implementing an Integrated Library Management System Project (LMS) to enhance the efficiency, accessibility, and overall functionality of libraries....

Future Enhancements for Library Management System Project

Integration with RFID or barcoding for efficient book tracking.Notification system for overdue books and fines.Online reservation of books.Integration with external databases for expanded book catalogue....

Check Out Some Other CS Relate Projects down below:

Portfolio Website ProjectWeather Forecast Project URL Shortener Project...

Contact Us