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
14 changes: 14 additions & 0 deletions End Term Practicals/CSEDS/44_2013694_Stuti_Bahuguna/Q1/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
$hostname = "127.0.0.1";
$username = "root";
$password = "";
$databasename = "Bookstore";

$conn = mysqli_connect($hostname, $username, $password, $databasename);
if($conn){
echo "Connection Successful...";
}
else{
echo "Connection failed..." + mysqli_connect_error();
}
?>
54 changes: 54 additions & 0 deletions End Term Practicals/CSEDS/44_2013694_Stuti_Bahuguna/Q1/form.php
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 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?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">
<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>
<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>
<td><a href="edit.php?id=<?php echo $row[0]?>">
<input type="button" value="Edit"></a></td>
<td><input type="button" value="delete"></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 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

50 changes: 50 additions & 0 deletions End Term Practicals/ques1/ques1.php.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<form action="server.php" method="POST">
Enter Book Name:<input type="text">
Enter author name: <input type="text">
Enter ISBN Number: <input type="text">
Enter Publisher Name: <input type="text">
Enter Publication Year: <select name="Year" id="">
<option value="2010">2010</option>
<option value="2011">2010</option>
<option value="2012">2010</option>
<option value="2013">2010</option>
<option value="2014">2010</option>
<option value="2015">2010</option>
<option value="2016">2010</option>
<option value="2017">2010</option>
<option value="2018">2010</option>
<option value="2019">2010</option>
<option value="2020">2010</option>
<option value="2021">2010</option>
</select>
Number of pages: <input type="number" min="200" max="400">
<input type="radio" id="action" name="booktype" value="action">
<label for="action">Action</label><br>
<input type="radio" id="adventure" name="booktype" value="adventure">
<label for="adventure">Adventure</label><br>
<input type="radio" id="classics" name="booktype" value="classics">
<label for="classics">Classics</label><br>
<input type="radio" id="comicbook" name="booktype" value="comicbook">
<label for="comicbook">Comic Book</label><br>
<input type="radio" id="graphicnovel" name="booktype" value="graphicnovel">
<label for="graphicnovel">Graphic Novel</label><br>
<input type="radio" id="detective" name="booktype" value="detective">
<label for="detective">Detective</label><br>
<input type="radio" id="mystery" name="booktype" value="mystery">
<label for="mystery">Mystery</label><br>
<input type="radio" id="hfiction" name="booktype" value="historical fiction">
<label for="historical fiction">Historical Fiction</label><br>
<input type="radio" id="horror" name="booktype" value="horror">
<label for="horror">Horror</label><br>
<input type="radio" id="lfiction" name="booktype" value="literary fiction">
<label for="literary fiction">Literary Fiction</label><br>
</form>
</body>
</html>
23 changes: 23 additions & 0 deletions End Term Practicals/ques1/server.php.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

$username="root";
$password="";
$database="BookStore";
$con=mysqli_connect('localhost',$username,$password,$database) or die("Connection Failed". mysqli_connect_error());

$book_name = $_REQUEST['bname'];
$isbn_no = $_REQUEST['isbnno'];
$publisher_name = $_REQUEST['pname'];
$publication_year = $_REQUEST['p_year'];
$no_pages =$_REQUEST['pno'];
$book_type = $_REQUEST['booktype'];
$insert_query="INSERT into Bookstore(bookname,isbnno,publisherno,publicationyear,nopages,booktype) values('$book_name' ,'$isbn_no' , '$publisher_name' ,'$publication_year' , '$no_pages' , '$book_type' )";

$insert=mysqli_query($con,$insert_query);

if($insert === TRUE)
echo '';
else
echo "Error" . $insert_query . "<br/>" . $con->error;

?>
19 changes: 19 additions & 0 deletions End Term Practicals/ques2/config.php.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
include('config.php');
?>
<?php

if(isset($_POST['btn'])){
$bookId=$_POST['bookid'];
$bookname = $_POST['bookname'];
$author = $_POST['authorname'];
$isbn = $_POST['isbnnumber'];
$publisher=$_POST['publisher'];
$publicationY=$_POST['year'];
$pages = $_POST['noOfPages'];
$booktype=$_POST['Type'];
$sql = "INSERT INTO `BookStore` (`bookname`, `author`, `isbn`,`publisher`,`publicationY`, `pages`, `booktype`) VALUES ('$bookId', '$bookname', '$author', '$isbn','$publisher','$publicationY','$pages','$booktype')";
$a = mysqli_query($conn , $sql);

}
?>
61 changes: 61 additions & 0 deletions End Term Practicals/ques2/question2.php.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?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">
<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>
<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>
<td><a href="edit.php?id=<?php echo $row[0]?>">
<input type="button" value="Edit"></a></td>
<td><input type="button" value="delete"></td>

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


<html>

<head>

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

</body>
</html>