Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php
include('config.php');
?>

<?php
if(isset($_POST['submit'])){
$Bookname = $_POST['Bookname'];
$Authorname = $_POST['Authorname'];
$isbn = $_POST['isbn'];
$Publishername = $_POST['Publishername'];
$Noofpages = $_POST['Noofpages'];
$Booktype = $_POST['Booktype'];
$Publicationyear = $_POST['Publicationyear'];


$sql = "INSERT INTO `Bookstore` (`Bookname`, `Authorname`, `isbn`, `Publishername`,`Noofpages`, `Booktype`, `Publicationyear`) VALUES ('$Bookname', '$Authorname', '$isbn', '$Publishername','$Noofpages', '$Booktype', '$Publicationyear')";
mysqli_query($conn, $sql);
}
else{
echo "Please click submit button to submit the data..";
}
?>
<html>
<head>
<title>HTML Forms</title>
</head>
<body>
<form method="POST" action="Que1.php">
Bookname <input type="text" name="Bookname" placeholder="Type Bookname" required><br>
Authorname <input type="text" name="Authorname" placeholder="Type Authorname" required><br>
isbn <input type="Number" name="isbn" placeholder="Type isbn" required><br>
Publishername <input type="text" name="Publishername" placeholder="Type Publishername" required><br>
Noofpages<input type="Number" name="Noofpages" placeholder="Type Noofpages" required><br>
Booktype<br>action <input type="radio" name="Booktype" value="action" checked>
adventure<input type="radio" name="Booktype" value="adventure" ><br>
classic<input type="radio" name="Booktype" value="classic" ><br>
Select Publicationyear <select name="Publicationyear">
<option value="2010">2010</option>
<option value="2011">2011</option>
<option value="2012">2012</option>
<option value="2013">2013</option>
<option value="2014">2014</option>
<option value="2015">2015</option>
<option value="2016">2016</option>
<option value="2017">2017</option>
<option value="2018">2018</option>
<option value="2019">2019</option>
<option value="2020">2020</option>
<option value="2021">2021</option>
</select><br>
<input type="submit" name="submit" value="Click Here To Submit Your Data">
</form>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
$hostname="localhost";
$username="root";
$password="";
$database="BookStore";

$conn=mysqli_connect($hostname, $username ,$password ,$database);
if($conn){
echo "Connection Successful...";
}
else{
echo "Connection failed..." +mysqli_connect_error();
}
?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php
include('config.php');
?>

<!-- Code to fetch data -->
<?php

$sql="SELECT * FROM users";
$result=mysqli_query($conn, $sql);

if($result!==false && $result->num_rows > 0){
?>

<table border="1px" align="center">
<thead>
<tr>
<th>BOOK ID</th>
<th>Book Name</th>
<th>Author</th>
<th>ISBN</th>
<th>Publisher</th>
<th>Publiction Year</th>
<th>Pages</th>
<th>Book Type</th>

</tr>
</thead>
<tbody>
<?php
while($row = $result->fetch_array()){?>
<tr height="30">
<td><?php echo $row[0]?></td>
<td><?php echo $row[1]?></td>
<td><?php echo $row[2]?></td>
<td><?php echo $row[3]?></td>
<td><?php echo $row[4]?></td>
<td><?php echo $row[5]?></td>
<td><?php echo $row[6]?></td>
<td><?php echo $row[7]?></td>


</tr>
<?php } ?>
</tbody>
</table>
<?php }
?>


<html>

<head>

<title>User Details</title>
</head>
<body>

</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
$hostname="localhost";
$username="root";
$password="";
$database="BookStore";

$conn=mysqli_connect($hostname, $username ,$password ,$database);
if($conn){
echo "Connection Successful...";
}
else{
echo "Connection failed..." +mysqli_connect_error();
}
?>