You are on page 1of 26

Annexure – I

Micro-Project Proposal

Online Book Issuing Application

1.0. Aims/Benefits of the Micro-Project


1. To Learn about input collection and validation.
2. To Learn about DataBase Connectivity.
3. To Implement Book , Issuing and Returning functionalities.
4. To use Basic programming concepts, those have been learnt in PHP.
5.We can use this project in library to simply issue the books to student and return them
back after their use.
2.0 Course Outcomes Addressed
CO Addressed/Not
Course Outcomes
No. Addressed
a) Develop program using control statement. Addressed
b) Perform operations based on arrays and graphics. Not Addressed
c) Develop program by applying various object-oriented
Not Addressed
concepts.
d) Use form controls with validation to collect user’s input. Addressed
e) Perform database operations in PHP. Addressed

2.0. Project Methodology


1. To gather information about the project and topic finalization.
2. Planning and Preparing project proposal
3. Functions we use
 User :- Which asks for desired username, email, and Password of the user, and then
sends the entered data into the database, once the submit button is clicked.
 Books :-Book is a medium for recording information, often a work of fiction or
nonfiction, in the form of writing or images.
 Issue :- Issuing a book typically refers to the publication or release of a book for
public availability .
 Return:- Returning a book usaually means giving it back to the place from which it
was borrowed, such as a library or bookstore ,after a specified period.

It include detailing the processes for user authentication , book availability and
transaction recording.
4. Data design :- It typically involves creating a well-structured database and utilizing the
appropriate methods to interact with it .We designed a database schema to store
information of user profiles, book details transaction history.
5. GUI Design :- It involves creating web – based interfaces using HTML, CSS.
 Key consideration for GUI design
1. HTML and CSS Integration
2. Template Engines
3. PHP Framework
4. Form Handling
5. User Authentication and Authorization.
3.0. Action Plan
Planned
Sr. Planned Name of Responsible
Details of activity Finish
No. Start Date Team Member
Date
Information Gathering and Topic
1 8/01/24 12/01/24 Sanjana Suryawanshi
Finalization
Preparing Project Proposal and
2 15/01/24 15/01/24 Sanjana Suryawanshi
Approval
3 Implementing Project 16/01/24 30/01/24 Sanjana Suryawanshi

4 Preparing Project Report 01/02/24 02/02/24 Sanjana Suryawanshi

5 Presenting Project 08/02/24 08/02/24 Sanjana Suryawanshi

6 Submission of Project and Report 10/02/24 10/02/24 Sanjana Suryawanshi

4.0. Resource Required


Sr.
Name of Resource/Material Specifications Qty. Remarks
No.
Computer System
01 Intel Core i3 01
(Desktop/Laptop)
02 Development Package XAMPP 3.2.4 01

03 Editor VS Code 01

Names of Team Members with Roll Nos.


Roll No Enrollment No Name of Team/Group Member
48 2107760068 Sanjana Sharad Suryawanshi

(to be approved by the concerned teacher)


Approved by

(Mr. A.P.Bhuse (Lecturer))


Name and Signature of Staff
Annexure – II
Micro-Project Report

Online Book Issuing Application

1.0. Rationale
An online book issuing application is important as it provides users with convenient access to a
wide range of books from the comfort of their devices .It also streamlines the borrowing
process, enhance online book store management, and promotes reading in the digital age. It is
more user – friendly, efficient, and adaptable to modern technology. Users can easily login,
can add book, borrow and return books .

 Following Features are used


1. User Registration
2. Book Details
3. Borrowing and Returning System
4. User Account Management

2.0. Aims/Benefits of the Micro-Project


1. To Learn about input collection and validation.
2. To Learn about DataBase Connectivity.
3. To Implement Book , Issuing and Returning functionalities.
4. To use Basic programming concepts, those have been learnt in PHP.
5.We can use this project in library to simply issue the books to student and return them
back after their use.

3.0. Course Outcomes Addressed


CO Addressed/Not
Course Outcomes
No. Addressed
a) Develop program using control statement. Addressed
b) Perform operations based on arrays and graphics. Not Addressed
c) Develop program by applying various object-oriented
Not Addressed
concepts.
d) Use form controls with validation to collect user’s input. Addressed
e) Perform database operations in PHP. Addressed

4.0. Literature Review


One key benefit of library book issuing systems is increased accuracy and improved
inventory management. With a centralized database of all books, libraries can track their
collections more effectively and reduce the risk of misplacing or losing books. This also makesit
easier for library staff to manage their inventory and ensure that books arereturned on time.
Another benefit of library book issuing systems is enhanced user experience. Patrons can easily
check the availability of books, reserve books online. This can help to encourage more people
to use the library and support its mission to promote literacy and lifelong learning.
 To implement this project, the technologies that are used –
- HTML, CSS and PHP

1. Registration Page:
- Allows users to create a new account by providing necessary information like
username and password.
- Validates user inputs to ensure data integrity and security.
- Upon successful registration, users are redirected to the login page.

2. Login Page:
- Provides a login interface for existing users to access their accounts.
- Authenticates user credentials against the database to grant access.
- Upon successful login, users are redirected to the dashboard or home page.

3. Home Page:
- Serves as the main landing page after login, displaying options for various actions.
- Provides links or buttons to navigate to different sections of the website, such as
adding a book, issuing a book, returning a book, or viewing book details.

4. Add Book:
- Allows authorized users to add new books to the library database.
- Collects information about the BookId, Book Title , Genre, and availability status.
- Validates book details to ensure accuracy and completeness before submission.

5. Issue Book:
- Enables users to borrow books from the library by selecting the desired book by
inserting BookId.
- Validates user inputs to ensure the selected book is available for borrowing.
- Updates the database to reflect the book's status as "issued" and records the
borrower's information by using user ID and issue date.

6. Return Book:
- Allows users to return borrowed books to the library by selecting the book from
their list of checked-out items.
- Validates user inputs to ensure the selected book is eligible for return.
- Updates the database to change the book's status back to "available" and records
the return date.

7. Display Books:
- Shows a comprehensive list of all books available in the library, including details
such as book ID, title, author, genre, and availability status.
- Indicates whether each book is currently available for borrowing or already
issued to a user.
- Allows users to filter or search for specific books based on criteria like genre or
title.
- Each page in the online book issue system serves a specific function and
contributes to the over all user experience by facilitating different aspects of
book management and lending processes.

 Connecting to Database
Before we can access data in the MySQL database, we need to be able to connect
to the server, that is, open a connection with database server to send command and
results.
By using mysqli_connect() function we can connect to the server and open
connection with database as shown below-

<?php
$servername="localhost";
$username="root";
$password="";
$db_name="db";
$conn=new mysqli($servername,$username,$password,$db_name);
if($conn->connect_error){
die("Connection Failed".$conn->connect_error);
}
echo"";
?>

 Creating Table:
The CREATE TABLE statement is used to create a table in MySQL. We will create a
table named "tbluser", with five columns: "id", "firstname", "lastname", "email"
and "reg_date":
For Example,
mysql> CREATE TABLE tbluser (
-> firstName VARCHAR(255) NOT NULL,
-> lastName VARCHAR(255),
-> email VARCHAR(255),
-> id VARCHAR(255) PRIMARY KEY NOT NULL,
-> branch VARCHAR(255),
-> year VARCHAR(255)
-> );

 Inserting Data in Table


After a database and a table have been created, we can start adding data in them.
Here are some syntax rules to follow:
1. The SQL query must be quoted in PHP.
2. String values inside the SQL query must be quoted.
3. Numeric values must not be quoted.
4. The word NULL must not be quoted.
The INSERT INTO statement is used to add new records to a MySQL table-
INSERT INTO table_name (columnl, column2, column3, ...) VALUES (valuel, value2,
value3, ...);

 Database Table of Book:


CREATE TABLE `book` (
`id` int(10) NOT NULL,
`bookid` varchar(100) NOT NULL,
`title` varchar(100) NOT NULL,
`genre` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
INSERT INTO `book` (`id`, `bookid`, `title`, `genre`) VALUES
(1, 'BOOK1201', 'Java', 'nonfiction'),
(2, 'BOOK1202', 'PHP', 'nonfiction'),
(3, 'BOOK1203', 'python', 'nonfiction'),
(4, 'BOOK1230', 'Programming in Python', 'nonfiction');
--

ALTER TABLE `book`


ADD PRIMARY KEY (`id`);

--
ALTER TABLE `book`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
COMMIT;

5.0. Actual Methodology Followed


1. To gather information about the project and topic finalization.
2. Planning and Preparing project proposal
3. Functions we use
 User :- Which asks for desired username, email, and Password of the user, and then
sends the entered data into the database, once the submit button is clicked.
 Books :-Book is a medium for recording information, often a work of fiction or
nonfiction, in the form of writing or images.
 Issue :- Issuing a book typically refers to the publication or release of a book for
public availability .
 Return:- Returning a book usaually means giving it back to the place from which it
was borrowed, such as a library or bookstore ,after a specified period.

It include detailing the processes for user authentication , book availability and
transaction recording.
4. Data design :- It typically involves creating a well-structured database and utilizing the
appropriate methods to interact with it .We designed a database schema to store
information of user profiles, book details transaction history.
5. GUI Design :- It involves creating web – based interfaces using HTML, CSS.
 Key consideration for GUI design
1. HTML and CSS Integration
2. Template Engines
3. PHP Framework
4. Form Handling
5. User Authentication and Authorization.

Planned
Sr. Planned Name of Responsible
Details of activity Finish
No. Start Date Team Member
Date
Information Gathering and Topic
1 08/01/24 12/01/24 Sanjana Suryawanshi
Finalization
Preparing Project Proposal and
2 15/01/24 15/01/24 Sanjana Suryawanshi
Approval
3 Implementing Project 16/01/24 30/01/24 Sanjana Suryawanshi

4 Preparing Project Report 01/02/24 02/02/24 Sanjana Suryawanshi

5 Presenting Project 08/02/24 08/02/24 Sanjana Suryawanshi

6 Submission of Project and Report 10/02/24 10/02/24 Sanjana Suryawanshi

6.0. Actual Resources Used


Sr.
Name of Resource/Material Specifications Qty. Remarks
No.
Computer System
1 Intel core i3 01
(desktop/laptop)
2 Development Package XAMPP 3.2.4 01

3 Editor VS Code 01

7.0. Output of the Micro-Project


The online book issue system website serves as a valuable resource for libraries, educational
institutions, community organizations, and book enthusiasts alike, facilitating the
dissemination of information, supporting academic and professional development, and
fostering a love for literature and learning in diverse communities.

8.0. Skill Developed/Learning outcomes of this Micro-Project


1. To gather requirements for the projects
2. To design the database and webpages using HTML form controls for implementing
solutions.
3. To code PHP scripts for webpage to implement the functionality of webpages
4. To prepare report for microproject and document everything.
5. To learn about new technologies, frameworks and methodologies as needed to keep in
web development.
9.0. Application of this Micro-Project
1. Enhances traditional library services, allowing users to borrow and return books digitally.
2. Facilitates the distribution of course material , textbooks, and academic resources.
3. Enables citizens to access a diverse range of books without physically visiting a library.
4. Integrates with online platforms to expand the reach and accessibility of books.

10.0 References
1. http://www.geeksforgeeks.org
2. http://www.w3schools.com
Annexure - IV
Micro-Project Evaluation Sheet
Name of Student: Sanjana Sharad Suryawanshi Enrollment No:2107760068
Name of Programme: Computer Engineering (CO) Semester: Sixth
Course Title: Web based Application Development with PHP Code: 22619
Title of the Micro-Project:
Course Outcomes Achieved:-
CO
Course Outcomes Achieved/Not Achieved
No.
a) Develop program using control statement. Achieved
b) Perform operations based on arrays and graphics. Not Achieved
c) Develop program by applying various object-oriented concepts. Not Achieved
d) Use form controls with validation to collect user’s input. Achieved
e) Perform database operations in PHP. Achieved

Sr. Characteristics to be Poor Average Good Excellent Sub-


No. assessed (Marks 1-3) (Marks 4-5) (Marks 6-8) (Marks 9-10) Total
(A) Process and Product Assessment (Convert above total marks out of 6 Marks)
1 Relevance to the course
Literature Review/
2
Information Collection
Completion of the Target
3
as per Project Proposal
Analysis of Data and
4
Representation
Quality of
5
Prototype/Model
6 Report Preparation
(B) Individual Presentation/Viva (Convert above total marks out of 4 Marks)
7 Presentation
8 Viva
(A) Process and Product Assessment (B) Individual Presentation/Viva Total Marks
(6 Marks) (4 Marks) (10 Marks)

Comments/Suggestions about team work/leadership/inter-personal communication (if any)

Name and Designation of the Teacher:Mr.A.P.Bhuse(Lecturer)

Dated Signature:
 Code
Index.html
<!doctype html>
<html lang="zxx">

<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Project</title>
<!-- Template CSS -->
<link rel="stylesheet" href="assets/css/style-starter.css">
<!-- Template CSS -->
<link href="//fonts.googleapis.com/css?family=Oswald:300,400,500,600&display=swap"
rel="stylesheet">
<link href="//fonts.googleapis.com/css?family=Lato:300,300i,400,400i,700,900&display=swap"
rel="stylesheet">
<!-- Template CSS -->

</head>
<body>
<!--w3l-banner-slider-main-->
<section class="w3l-banner-slider-main inner-pagehny">
<div class="breadcrumb-infhny">

<div class="top-header-content">

<header class="tophny-header">
<div class="container-fluid">
name="form"> address</p>

</ul>
<!--//right-->
<div class="overlay-login text-left">
<button type="button" class="overlay-close1">
<i class="fa fa-times" aria-hidden="true"></i>
</button>
<div class="wrap">
<h5 class="text-center mb-4">Login Now</h5>
<div class="login-bghny p-md-5 p-4 mx-auto mw-100">
<!--/login-form-->
<form action="index.html" method="post"
<div class="form-group">
<p class="login-texthny mb-2">Email

<input type="email" class="form-control"

id="exampleInputEmail1" aria-describedby="emailHelp"
text-muted">We'll never share your email

placeholder="" required="">
<small id="emailHelp" class="form-text

with anyone else.</small>

</div>
<div class="form-group">
<p class="login-texthny mb-2">Password</p>
<input type="password" class="form-control" id="exampleInputPassword1" placeholder=""
required="">
</div>
<div class="form-check mb-2">
<div class="userhny-check">
<label class="check-remember container">
<input type="checkbox" class="form-check"> <span class="checkmark"></span>
<pclass="privacy-policy">Remember

me</p>mb-4">Sign In</button>

</label>
<div class="clearfix"></div>
</div>
</div>
<button type="submit" class="submit-login btn

</form>
<!--//login-form-->
</div>
<!---->
</div>
</div>
</div>
</div>
<!--/nav-->
<nav class="navbar navbar-expand-lg navbar-light">
<div class="container-fluid serarc-fluid">
<a class="navbar-brand" href="index.html"> E<span class="lohny"></span>-BOOK</a>
<!-- if logo is image enable this
<a class="navbar-brand" href="#index.html">
<img src="image-path" alt="Your logo"
title="Your logo" style="height:35px;" />
</a> -->
<!--/search-right-->
<div class="search-right">

<div id="search" class="pop-overlay">


<div class="popup">

<form action="#" method="post" class="search-box">


<input type="search" placeholder="Keyword" name="search" required="required" autofocus="">
<button type="submit" class="btn">Search</button>
</form>

</div>

<a class="close" href="#">×</a>


</div>
<!-- /search popup -->
</div>
<!--//search-right-->
<button class="navbar-toggler" type="button" data-toggle="collapse" data-
target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon fa fa-bars"> </span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="register.php">New User</a>
</li>

<li class="nav-item ">


<a class="nav-link" href="addbook.php">Add Book</a>
</li>
<li class="nav-item">
<a class="nav-link" href="book.php">Books</a>
</li>

<li class="nav-item">
<a class="nav-link" href="issue.php">Issue</a>
</li>

<li class="nav-item">
<a class="nav-link" href="return.php">Return</a>
</li>
</ul>

</div>
</div>
</nav>
<!--//nav-->
</header>

<div class="breadcrumb-contentnhy">
<div class="container">
<nav aria-label="breadcrumb">
<h2 class="hny-title text-center">Knowledge Grows on the Bookshelf
of Patience</h2>

</nav>
</div>
</div>
</div>
</section>
<section class="w3l-grids-hny-2">
<!-- /content-6-section -->
<div class="grids-hny-2-mian py-5">
<div class="container py-lg-5">

<h3 class="hny-title mb-0 text-center">Read With


<span>Us</span></h3>
<p class="mb-4 text-center">Pick your favourite one</p>
<div class="welcome-grids row mt-5">
<div class="col-lg-2 col-md-4 col-6 welcome-image">
<div class="boxhny13">
<a href="#URL">
<img

src="assets/images/c++.jpg" class="img-fluid" alt="" />

<div class="boxhny-content">
<h3 class="title">Book

</div>
</a>
</div>

<h4><a href="https://www.w3schools.com/cpp/cpp_intro.asp">C++<br>Programming</a></h4>

</div>

<div class="col-lg-2 col-md-4 col-6 welcome-image">


<div class="boxhny13">
<a href="#URL">
<img

src="assets/images/c.jpg" class="img-fluid" alt="" />

class="title">Book</h3>

<div class="boxhny-content">
<h3

</div>

</a>
</div>

<h4><a href="https://www.w3schools.com/c/c_intro.php?external_link=true">
C<br> Programming</a></h4>

</div>
<div class="col-lg-2 col-md-4 col-6 welcome-image">
<div class="boxhny13">
<a href="#URL">
img

src="assets/images/java.png" class="img-fluid" alt="" />


class="title">Book</h3>

<div class="boxhny-content">
<h3

</div>

</a>

</div>

<h4><a href="https://www.geeksforgeeks.org/best-books-to-learn-java-for-beginners-and-experts/"
>Java<br> Programming</a></h4>
</div>
<div class="col-lg-2 col-md-4 col-6 welcome-image">
<div class="boxhny13">
<a href="#URL">
<img
src="assets/images/advaced java.webp" class="img-fluid" alt="" />
<div class="boxhny-content">
<h3

class="title">Book</h3>
</div>
</a>
</div>

<h4><a href="https://www.javatpoint.com/advanced-java-books-in-2021">Advanced Java<br>


Programming</a></h4>

</div>
<div class="col-lg-2 col-md-4 col-6 welcome-image">
<div class="boxhny13">
<a href="#URL">
<img
src="assets/images/data.jpg" class="img-fluid" alt="" />
class="title">Book</h3>
<div class="boxhny-content">
<h3
</div>
</a>

</div>
<h4><a href="https://www.geeksforgeeks.org/best-data-structures-and-algorithms-books/">
Data<br> Structure</a></h4>

</div>
<div class="col-lg-2 col-md-4 col-6 welcome-image">
<div class="boxhny13">
<a href="#URL">
<img

src="assets/images/php.webp" class="img-fluid" alt="" />


class="title">Book</h3>
<div class="boxhny-content">
<h
</div>
</a>
</div>

<h4><a href="https://www.w3schools.com/php/php_filter_advanced.asp">
Advanced<br> PHP</h4>
</div>
</div>

</div>
</div>

<script>
// When the user scrolls down 20px from the top of the document, show the button window.onscroll =
function () {
scrollFunction()
};

function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
document.getElementById("movetop").style.display = "block";
} else {
document.getElementById("movetop").style.display = "none";
}
}

// When the user clicks on the button, scroll to the top of the document function topFunction() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}
</script>
</body>

</html>

<script src="assets/js/jquery-3.3.1.min.js"></script>
<script src="assets/js/jquery-2.1.4.min.js"></script>

<!--/login-->
<script>
$(document).ready(function () {
$(".button-log a").click(function () {
$(".overlay-login").fadeToggle(200);
$(this).toggleClass('btn-open').toggleClass('btn-close');

});
});
$('.overlay-close1').on('click', function () {
$(".overlay-login").fadeToggle(200);
$(".button-log a").toggleClass('btn-open').toggleClass('btn-close'); open = false;

</script>
<!--//login-->
<script>
// optional

});
</script>
<!-- cart-js -->

});
$('#customerhnyCarousel').carousel({
interval: 5000

<script src="assets/js/minicart.js"></script>
<script> transmitv.render();
transmitv.cart.on('transmitv_checkout', function (evt) { var items, len, i;

if (this.subtotal() > 0) { items = this.items();

for (i = 0, len = items.length; i < len; i++) {}


}
});
</script>
<!-- //cart-js -->
<!--pop-up-box-->
<script src="assets/js/jquery.magnific-popup.js"></script>
<!--//pop-up-box-->
<script>
$(document).ready(function () {
$('.popup-with-zoom-anim').magnificPopup({ type: 'inline',
fixedContentPos: false, fixedPos: true, overflowY: 'auto', closeBtnInside: true, preloader: false,
midClick: true, removalDelay: 300,

mainClass: 'my-mfp-zoom-in'
});
});
</script>
<!--//search-bar-->
<!-- disable body scroll which navbar is in active -->

<script>
$(function () {
$('.navbar-toggler').click(function () {
$('body').toggleClass('noscroll');
})
});
</script>
<!-- disable body scroll which navbar is in active -->
<script src="assets/js/bootstrap.min.js"></script>

AddBook.php

<?php if(isset($_POST['submit'])){
include "dbconnect.php";
$bookid = $_POST['bookid'];
$title = $_POST['title'];
$genre = $_POST['genre'];
$sql = "INSERT INTO book (bookid, title, genre) VALUES ('$bookid', '$title', '$genre')";

if(mysqli_query($conn, $sql)){ echo '<script>


alert("Book added successfully!"); window.location.href = "index.html";
</script>';
} else{
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}

mysqli_close($conn);
}
?>

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Add New Book Form</title>


<style>
body {
font-family: Arial, sans-serif; background-color: #f4f4f4; margin: 0;
padding: 0; display: flex;
align-items: center; justify-content: center; height: 100vh;
}

form {
background-color: #fff; padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); width: 300px;
}

label {
display: block; margin-bottom: 8px;
}

input, select {
width: 100%; padding: 8px;
margin-bottom: 16px; box-sizing: border-box;
}

button {
background-color: #4caf50; color: #fff;
padding: 10px; border: none; border-radius: 4px; cursor: pointer; width: 100%;
}

.redirect-button { position: absolute; top: 10px;


right: 10px;
background-color: #3498db; color: #fff;

padding: 8px; border: none; border-radius: 4px; cursor: pointer;


text-decoration: none;
}
</style>
</head>

<body>

<a href="index.html" class="redirect-button">Go to Homepage</a>

<form action="addbook.php" method="post">


<label for="bookid">Book ID:</label>
<input type="text" id="bookid" name="bookid" required>

<label for="bookTitle">Book Title:</label>


<input type="text" id="title" name="title" required>

<label for="genre">Genre:</label>
<select id="genre" name="genre" required>
<option value="fiction">Fiction</option>
<option value="nonfiction">Non-Fiction</option>
<option value="mystery">Mystery</option>
</select>

<button type="submit" name="submit">Add Book</button>


</form>

</body>

</html>
<?php if(isset($_POST['submit'])){
include "dbconnect.php";
$bookid = $_POST['bookid'];
$title = $_POST['title'];
$genre = $_POST['genre'];
$sql = "INSERT INTO book (bookid, title, genre) VALUES ('$bookid', '$title', '$genre')";
if(mysqli_query($conn, $sql)){ echo '<script>
alert("Book added successfully!"); window.location.href = "index.html";
</script>';
} else{
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}

mysqli_close($conn);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Add New Book Form</title>
<style>
body {
font-family: Arial, sans-serif; background-color: #f4f4f4; margin: 0;
padding: 0; display: flex;
align-items: center; justify-content: center; height: 100vh;
}

form {
background-color: #fff; padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); width: 300px;
}

label {
display: block; margin-bottom: 8px;
}

input, select {
width: 100%; padding: 8px;
margin-bottom: 16px; box-sizing: border-box;
}

button {
background-color: #4caf50; color: #fff;
padding: 10px; border: none; border-radius: 4px; cursor: pointer; width: 100%;
}

.redirect-button { position: absolute; top: 10px;


right: 10px;
background-color: #3498db; color: #fff;
padding: 8px; border: none; border-radius: 4px; cursor: pointer;
text-decoration: none;
}
</style>
</head>
<body>
<a href="index.html" class="redirect-button">Go to Homepage</a>
<form action="addbook.php" method="post">
<label for="bookid">Book ID:</label>
<input type="text" id="bookid" name="bookid" required>

<label for="bookTitle">Book Title:</label>


<input type="text" id="title" name="title" required>

<label for="genre">Genre:</label>
<select id="genre" name="genre" required>
<option value="fiction">Fiction</option>
<option value="nonfiction">Non-Fiction</option>
<option value="mystery">Mystery</option>
</select>
<button type="submit" name="submit">Add Book</button>
</form>
</body>
</html>

Book.php

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>View Books</title>
<style>
body {
font-family: Arial, sans-serif; background-color: #f4f4f4; margin: 0;
padding: 0; position: relative;
}

table {
border-collapse: collapse; width: 60%;
margin: 20px auto;
}

th,
td {
border: 1px solid #dddddd; text-align: left;
padding: 8px;
}

th {
background-color: #f2f2f2;
}

.top-right {
position: absolute; top: 10px;
right: 10px;
}

.redirect-button { position: absolute; top: 10px;


right: 10px;
background-color: #3498db; color: #fff;
padding: 8px; border: none; border-radius: 4px; cursor: pointer;
text-decoration: none;
}
</style>
</head>
<body>
<?php
include "dbconnect.php";
$sql = "SELECT t.bookid, u.userid, b.title, b.genre, t.status FROM transaction t
INNER JOIN book b ON t.bookid = b.bookid INNER JOIN users u ON t.userid = u.userid";
$result = mysqli_query($conn, $sql); if ($result) {

if (mysqli_num_rows($result) > 0) { echo "<table>";


echo "<thead>"; echo "<tr>";
echo "<th>Book ID</th>"; echo "<th>User ID</th>"; echo "<th>Title</th>"; echo "<th>Genre</th>";
echo "<th>Status</th>"; echo "</tr>";
echo "</thead>"; echo "<tbody>";
while ($row = mysqli_fetch_assoc($result)) { echo "<tr>";
echo "<td>" . $row["bookid"] . "</td>";
echo "<td>" . $row["userid"] . "</td>";
echo "<td>" . $row["title"] . "</td>";
echo "<td>" . $row["genre"] . "</td>";
echo "<td>" . $row["status"] . "</td>"; echo "</tr>";
}

echo "</tbody>"; echo "</table>";


} else {
echo "<p>No records found</p>";
}
} else {
echo "Error: " . mysqli_error($conn);
}

mysqli_close($conn);
?>
</tbody>
</table>
<a href="index.html" class="redirect-button">Go to Homepage</a>
</body>
</html>
MET’s Institute of Technology, Polytechnic, Nashik 26

You might also like