504 - PHP Assignment Final
504 - PHP Assignment Final
Third Year
Bachelor of Computer Application (T.Y.B.C.A.)
Semester - V
File Submission
506: Practical of Web Framework
and Services
YEAR: 2022-23
Submitted by
Roll No : 45
Name : Harsh J. Mendapara
Submitted To
Prof. Pinal Solanki
VIMAL TORMAL PODDAR BCA COLLEGE
BACHELOR
OF
COMPUTER APPLICATION
B.C.A
Certificate
Page
Sr. No Date Query Sign.
No.
Q1 05-09-2022 Create a web page using PHP which 1
accept item informationlike item To
name, item type, andquantity from 5
the customer which gives the facility
of placing the order. Also give
facility of displaying order
according to order no.
Q2 05-09-2022 Create a web page using PHP which 6
accept ticket booking information like To
client_name, source, destination, 9
address, nos. Of passenger travelling,
travelling date and train number. Store
these records using mySQLdatabase.
Provide insert and
navigation options.
Q3 05-09-2022 Create a web page using PHP which 10
accepts student information like roll To
no, name,age, city and 13
phone_number.
Store these records in mySQL
database. Provide insert, updateby roll
no. & view options.
Config.php file
Q1) . Create a web page using PHP which accept item information like item name,
item type, and quantity from the customer which gives the facility of placing the
order. Also give facility of displaying order according to order no.
<?php
include("config.php");
?>
<html>
<head>
<title> Question - 1 </title>
</head>
<body>
<center>
<h1> Question - 1</h1>
<form name="form" method="POST" action="">
<table>
<tr>
<td> Enter Order No :- :- </td>
<td>
<input type="number" name="orderno" placeholder="Order No">
</td>
</tr>
<tr>
<td> Enter Item Name :- :- </td>
<td>
<input type="text" name="name" placeholder="Item Name">
</td>
</tr>
<tr>
<td> Enter Item Type :- </td>
<td>
<input type="text" name="type" placeholder="Item Type">
</td>
</tr>
<tr>
<td> Enter Item Quantity :- </td>
<td>
<input type="number" name="qty" placeholder="Item Quantity">
</td>
</tr>
</table>
<table>
<tr>
<br>
<td>
<input type="submit" name="insert" value="Place Order">
<input type="submit" name="update" value="Update Order">
<input type="submit" name="delete" value="Delete Order">
<input type="submit" name="search" value="Search Order">
<input type="submit" name="display" value="Display Order">
</td>
</tr>
</table>
</form>
<br>
<table border="1">
<tr>
<th>Order No</th>
<th>Order Name</th>
<th>Order Type</th>
<th>Order Quantity</th>
</tr>
<?php
//searching functionality
if (isset($_POST["search"])) {
$on = $_POST["orderno"];
$res = mysqli_query($con, "select * from orderlist where orderno ='$on'");
while ($row = mysqli_fetch_array($res)) {
echo "<tr>";
echo "<td>";
echo $row["orderno"];
echo "</td>";
echo "<td>";
echo $row["ordername"];
echo "</td>";
echo "<td>";
echo $row["ordertype"];
echo "</td>";
echo "<td>";
echo $row["orderquantity"];
echo "</td>";
echo "</tr>";
}
}
//displaying functionality
if (isset($_POST["display"])) {
$res = mysqli_query($con, "select * from orderlist order by orderno");
while ($row = mysqli_fetch_array($res)) {
echo "<tr>";
echo "<td>";
echo $row["orderno"];
echo "</td>";
echo "<td>";
echo $row["ordername"];
echo "</td>";
echo "<td>";
echo $row["ordertype"];
echo "</td>";
echo "<td>";
echo $row["orderquantity"];
echo "</td>";
echo "</tr>";
}
}
//insert functionality
if (isset($_POST["insert"])) {
$on = $_POST["orderno"];
$rn = $_POST["name"];
$ty = $_POST["type"];
$qy = $_POST["qty"];
if ($on != "" && $rn != "" && $ty != "" && $qy != "") {
$querry = "insert into orderlist values('$on','$rn','$ty','$qy')";
mysqli_query($con, $querry);
}
}
//update functionality
if (isset($_POST["update"])) {
$on = $_POST["orderno"];
$rn = $_POST["name"];
$ty = $_POST["type"];
$qy = $_POST["qty"];
if ($on != "" && $rn != "" && $ty != "" && $qy != "") {
$querry = "update orderlist set orderno='$on' , name='$rn',type='$ty',qty='$qy'
where orderno='$on'";
mysqli_query($con, $querry);
}
}
//delete functionality
if (isset($_POST["delete"])) {
$on = $_POST["orderno"];
$rn = $_POST["name"];
$ty = $_POST["type"];
$qy = $_POST["qty"];
?>
</table>
</center>
</body>
</html>
Q2). Create a web page using PHP which accept ticket booking information like
client_name, source, destination, address, nos. Of passenger travelling, travelling
date and train number. Store these records using mySQL database. Provide insert
and navigation options.
<?php
include("config.php");
?>
<html>
<head>
<title>
Question - 2
</title>
<body>
<center>
<h1> Question - 2</h1>
<form name="form" method="POST" action="">
<table>
<tr>
<td> Enter Id :- :- </td>
<td> <input type="number" name="id" placeholder="Id"></td>
</tr>
<tr>
<td> Enter Client Name :- </td>
<td> <input type="text" name="clientname" placeholder="Client Name"></td>
</tr>
<tr>
<td> Enter Source :- </td>
<td> <input type="text" name="source" placeholder="Source"></td>
</tr>
<tr>
<td> Enter Destination :- </td>
<td> <input type="text" name="destination" placeholder="Destination"></td>
</tr>
<tr>
<td> Enter Address :- </td>
<td> <textarea name="address" placeholder="Enter Address" rows="5" cols="15">
</textarea>
</td>
</tr>
<tr>
<td> Enter No of Passenger Travelling :- </td>
<td> <input type="number" name="no_of_passen" placeholder="Enter No of
Passenger Travelling"></td>
</tr>
<tr>
<td> Enter Travelling Date :- </td>
<td> <input type="date" name="travellingdate" placeholder="travelling date">
</td>
</tr>
<tr>
<td> Enter vehicle Number :- </td>
<td> <input type="number" name="vehicleno" placeholder="vehicle number">
</td>
</tr>
</table>
<table>
<tr>
<br>
<td> <input class="btn1" type="submit" name="insert" value="Insert">
</td>
</tr>
</table>
</form>
<br>
<table border="1">
<tr>
<th>Id</th>
<th>Client Name</th>
<th>Source</th>
<th>Destination</th>
<th>Address</th>
<th>No of Passenger Travelling</th>
<th>Travelling Date</th>
<th>vehicle Number</th>
</tr>
<?php
$res = mysqli_query($con, "select * from travel_agent");
while ($row = mysqli_fetch_array($res)) {
echo "<tr>";
echo "<td>";
echo $row["id"];
echo "</td>";
echo "<td>";
echo $row["clientname"];
echo "</td>";
echo "<td>";
echo $row["source"];
echo "</td>";
echo "<td>";
echo $row["destination"];
echo "</td>";
echo "<td>";
echo $row["address"];
echo "</td>";
echo "<td>";
echo $row["no_of_passen"];
echo "</td>";
echo "<td>";
echo $row["travellingdate"];
echo "</td>";
echo "<td>";
echo $row["vehicleno"];
echo "</td>";
echo "</tr>";
}
if (isset($_POST['insert'])) {
$id = $_POST['id'];
$clientname = $_POST['clientname'];
$source = $_POST['source'];
$destination = $_POST['destination'];
$address = $_POST['address'];
$no_of_passen = $_POST['no_of_passen'];
$travellingdate = $_POST['travellingdate'];
$vehicleno = $_POST['vehicleno'];
if ($id != "" && $clientname != "" && $source != "" && $destination != "" && $address
!= "" && $no_of_passen != "" && $travellingdate != "" && $vehicleno != "") {
$querry = "insert into travel_agent
values('$id','$clientname','$source','$destination','$address','$no_of_passen','$travellingdate','
$vehicleno')";
mysqli_query($con, $querry);
}
}
?>
</table>
</center>
</body>
</html>
Q3. Create a web page using PHP which accepts student information like roll no,
name, age, city and phone_number. Store these records in mySQL database.
Provide insert, update by roll no. & view options.
<?php
include("config.php");
?>
<html>
<head>
<title>
Question - 3
</title>
<body>
<center>
<h1> Question - 3</h1>
<form name="form" method="POST" action="">
<table>
<tr>
<td> Enter Roll No :- :- </td>
<td> <input type="number" name="roll" placeholder="Roll No"></td>
</tr>
<tr>
<td> Enter Name :- :- </td>
<td> <input type="text" name="name" placeholder="Name"></t d>
</tr>
<tr>
<td> Enter Age :- </td>
<td> <input type="number" name="age" placeholder="Age"></t d>
</tr>
<tr>
<td> Enter City :- </td>
<td> <input type="text" name="city" placeholder="City"></t d>
</tr>
<tr>
<td> Enter Mobile No :- </td>
<td> <input type="number" name="mobile" placeholder="MObile Number"></td>
</tr>
</table>
<table>
<tr>
<br>
<td> <input type="submit" class="btn1" name="insert" value="Insert">
<input type="submit" class="btn1" name="update" value="Update">
<input type="submit" class="btn1" name="display" value="Display">
</td>
</tr>
</table>
</form>
<br>
<table border="1">
<tr>
<th>Roll</th>
<th>Name</th>
<th>Age</th>
<th>City</th>
<th>Mobile NUmber</th>
</tr>
<?php
if (isset($_POST['display'])) {
$res = mysqli_query($con, "select * from stud_info");
while ($row = mysqli_fetch_array($res)) {
echo "<tr>";
echo "<td>";
echo $row["roll"];
echo "</td>";
echo "<td>";
echo $row["name"];
echo "</td>";
echo "<td>";
echo $row["age"];
echo "</td>";
echo "<td>";
echo $row["city"];
echo "</td>";
echo "<td>";
echo $row["mobile"];
echo "</td>";
echo "</tr>";
}
}
if (isset($_POST['insert'])) {
$roll = $_POST['roll'];
$name = $_POST['name'];
$age = $_POST['age'];
$city = $_POST['city'];
$mobile = $_POST['mobile'];
if (
$roll != "" && $name != "" && $age != "" && $city != "" && $mobile != ""
){
$querry = "insert into stud_info values('$roll','$name','$age','$city','$mobile')";
mysqli_query($con, $querry);
}
}
if (isset($_POST['update'])) {
$roll = $_POST['roll'];
$name = $_POST['name'];
$age = $_POST['age'];
$city = $_POST['city'];
$mobile = $_POST['mobile'];
if (
$roll != "" && $name != "" && $age != "" && $city != "" && $mobile != ""
){
$querry = "update stud_info set roll='$roll' ,
name='$name',age='$age',city='$city',mobile='$mobile' where roll='$roll'";
mysqli_query($con, $querry);
}
}
?>
</table>
</center>
</body>
</html>
Q4. Create web pages which accept book details like book_code, book_name,
author_name, cost, ISBN_No. Create database and provide facility to updating
book by book_code and searching by book_name and author_name.
<?php
include("config.php");
?>
<html>
<head>
<title>
Question - 4
</title>
<body>
<center>
<h1> Question - 4</h1>
<form name="form" method="POST" action="">
<table>
<tr>
</table>
</form>
<br>
<table border="1">
<tr>
<th>Book Code</th>
<th>Book Name</th>
<th>Author Name</th>
<th>Cost</th>
<th>Isbn No</th>
</tr>
<?php
if (isset($_POST['display'])) {
$res = mysqli_query($con, "select * from book_data");
while ($row = mysqli_fetch_array($res)) {
echo "<tr>";
echo "<td>";
echo $row["bookcode"];
echo "</td>";
echo "<td>";
echo $row["bookname"];
echo "</td>";
echo "<td>";
echo $row["authorname"];
echo "</td>";
echo "<td>";
echo $row["cost"];
echo "</td>";
echo "<td>";
echo $row["isbnno"];
echo "</td>";
echo "</tr>";
}
}
if (isset($_POST['search'])) {
$bookcode = $_POST['bookcode'];
$bookname = $_POST['bookname'];
$authorname = $_POST['authorname'];
$cost = $_POST['cost'];
$isbnno = $_POST['isbnno'];
$res = mysqli_query($con, "select * from book_data where bookcode='$bookcode' ||
authorname='$authorname'");
while ($row = mysqli_fetch_array($res)) {
echo "<tr>";
echo "<td>";
echo $row["bookcode"];
echo "</td>";
echo "<td>";
echo $row["bookname"];
echo "</td>";
echo "<td>";
echo $row["authorname"];
echo "</td>";
echo "<td>";
echo $row["cost"];
echo "</td>";
echo "<td>";
echo $row["isbnno"];
echo "</td>";
echo "</tr>";
}
}
// else {
// $res = mysqli_query($con, "select * from book_data");
// while ($row = mysqli_fetch_array($res)) {
// echo "<tr>";
// echo "<td>";
// echo $row["bookcode"];
// echo "</td>";
// echo "<td>";
// echo $row["bookname"];
// echo "</td>";
// echo "<td>";
// echo $row["authorname"];
// echo "</td>";
// echo "<td>";
// echo $row["cost"];
// echo "</td>";
// echo "<td>";
// echo $row["isbnno"];
// echo "</td>";
// echo "</tr>";
// }
// }
if (isset($_POST['insert'])) {
$bookcode = $_POST['bookcode'];
$bookname = $_POST['bookname'];
$authorname = $_POST['authorname'];
$cost = $_POST['cost'];
$isbnno = $_POST['isbnno'];
if ($bookcode != "" && $bookname != "" && $authorname != "" && $cost != "" &&
$isbnno != "") {
$querry = "insert into book_data
values('$bookcode','$bookname','$authorname','$cost','$isbnno')";
mysqli_query($con, $querry);
}
}
if (isset($_POST['update'])) {
$bookcode = $_POST['bookcode'];
$bookname = $_POST['bookname'];
$authorname = $_POST['authorname'];
$cost = $_POST['cost'];
$isbnno = $_POST['isbnno'];
if ($bookcode != "" && $bookname != "" && $authorname != "" && $cost != "" &&
$isbnno != "") {
$querry = "update book_data set bookcode='$bookcode' ,
bookname='$bookname',authorname='$authorname',cost='$cost',isbnno='$isbnno' where
bookcode='$bookcode'";
mysqli_query($con, $querry);
}
}
?>
</table>
</center>
</body>
</html>
Q5. Create a website for online mobile shopping of different companies. This
website displays different mobiles with their prices. (Company, Model Name,
price, etc.) Admin can add or remove mobiles. Customer can search mobile
according to price. Also provide proper validations.
<?php
include("config.php");
?>
<html>
<head>
<title>
Question - 5
</title>
<body>
<center>
<h1> Question - 5</h1>
<form name="form" method="POST" action="">
<table>
<tr>
<td> Enter Mobile id :- :- </td>
<td> <input type="number" name="mob_id" placeholder="Mobile Id"></td>
</tr>
<tr>
<td> Enter Company Name :- :- </td>
<td> <input type="text" name="company" placeholder="Company"></td>
</tr>
<tr>
<td> Enter Model Name :- </td>
<td> <input type="text" name="model" placeholder="Model"></td>
</tr>
<tr>
<td> Enter price :- </td>
<td> <input type="number" name="price" placeholder="Price"></td>
</tr>
</table>
<table>
<tr>
<br>
<td> <input type="submit" class="btn1" name="insert" value="Insert">
<input type="submit" class="btn1" name="delete" value="Delete">
<input type="submit" class="btn1" name="search" value="Search">
</td>
</tr>
</table>
</form>
<br>
<table border="1">
<tr>
<th>No of Product</th>
<th>Company Name</th>
<th>Model Name</th>
<th>Price</th>
</tr>
<?php
if (isset($_POST['search'])) {
$price = $_POST['price'];
$res = mysqli_query($con, "select * from mobile_shop where price = '$price'");
while ($row = mysqli_fetch_array($res)) {
echo "<tr>";
echo "<td>";
echo $row["mob_id"];
echo "</td>";
echo "<td>";
echo $row["company"];
echo "</td>";
echo "<td>";
echo $row["model"];
echo "</td>";
echo "<td>";
echo $row["price"];
echo "</td>";
echo "</tr>";
}
} else
$res = mysqli_query($con, "select * from mobile_shop");
while ($row = mysqli_fetch_array($res)) {
echo "<tr>";
echo "<td>";
echo $row["mob_id"];
echo "</td>";
echo "<td>";
echo $row["company"];
echo "</td>";
echo "<td>";
echo $row["model"];
echo "</td>";
echo "<td>";
echo $row["price"];
echo "</td>";
echo "</tr>";
}
if (isset($_POST['insert'])) {
$mob_id = $_POST['mob_id'];
$company = $_POST['company'];
$model = $_POST['model'];
$price = $_POST['price'];
if ($mob_id != "" && $company != "" && $model != "" && $price != "") {
$querry = "insert into mobile_shop values('$mob_id','$company','$model','$price')";
mysqli_query($con, $querry);
}
}
if (isset($_POST['delete'])) {
$mob_id = $_POST['mob_id'];
$company = $_POST['company'];
$model = $_POST['model'];
$price = $_POST['price'];
</html>
Q6. Create a web page for AMAZON that gives order details and status of order
according to the order no. given by customer. Give appropriate validations. Also
give facility for viewing past orders by date. (Tables : cust_mast, item_mast,
order_mast, order_detail)
Q7. Create a registration page for matrimony website with all required
validations. Fields are like person_name, city, mobno, cast, subcast, gender,
qualification, etc. Also give facility of searching records by city and cast. Use
concept of session.
<?php
include("config.php");
session_start();
if (isset($_POST['insert'])) {
$personname = $_POST['personname'];
$city = $_POST['city'];
$mobile = $_POST['mobile'];
$cast = $_POST['cast'];
$subcast = $_POST['subcast'];
$gender = $_POST['gender'];
$qualification = $_POST['qualification'];
$_SESSION['personname'] = $personname;
$_SESSION['city'] = $city;
$_SESSION['mobile'] = $mobile;
$_SESSION['cast'] = $cast;
$_SESSION['subcast'] = $subcast;
$_SESSION['gender'] = $gender;
$_SESSION['qualification'] = $qualification;
}
?>
<html>
<head>
<title>
Question - 7
</title>
<body>
<center>
<h1> Question - 7</h1>
<form name="form" method="POST" action="">
<table>
<tr>
<td> Enter Person Name :- :- </td>
<td> <input type="text" name="personname" placeholder="person Name"></t d>
</tr>
<tr>
<td> Enter City :- :- </td>
<td> <input type="text" name="city" placeholder="City"></td>
</tr>
<tr>
<td> Enter Mobile Number :- </td>
<td> <input type="number" name="mobile" placeholder="Mobile Number"></ td>
</tr>
<tr>
<tr>
<br>
<td> <input type="submit" class="btn1" name="insert" value="Insert">
<input type="submit" class="btn1" name="search" value="Search">
</td>
</tr>
</table>
</form>
<br>
<table border="1">
<tr>
<th>Person Name</th>
<th>City</th>
<th>Mobie Number</th>
<th>Cast</th>
<th>Sub Cast</th>
<th>Gender</th>
<th>Qualification</th>
</tr>
<?php
if (isset($_POST['search'])) {
$city = $_POST['city'];
$cast = $_POST['cast'];
echo "<td>";
echo $row["city"];
echo "</td>";
echo "<td>";
echo $row["mobile"];
echo "</td>";
echo "<td>";
echo $row["cast"];
echo "</td>";
echo "<td>";
echo $row["subcast"];
echo "</td>";
echo "<td>";
echo $row["gender"];
echo "</td>";
echo "<td>";
echo $row["qualification"];
echo "</td>";
echo "</tr>";
}
}
if (isset($_POST['insert'])) {
$personname = $_POST['personname'];
$city = $_POST['city'];
$mobile = $_POST['mobile'];
$cast = $_POST['cast'];
$subcast = $_POST['subcast'];
$gender = $_POST['gender'];
$qualification = $_POST['qualification'];
if ($personname != "" && $city != "" && $mobile != "" && $cast != "" && $subcast != ""
&& $gender != "" && $qualification != "") {
// $querry = "insert into matrimony
values('0','$personname','$city','$mobile','$cast','$subcast','$gender','$qualification')";
$querry = "INSERT INTO matrimony (id, personname, city, mobile, cast, subcast,
gender, qualification) VALUES
('0','$personname','$city','$mobile','$cast','$subcast','$gender','$qualification')";
mysqli_query($con, $querry);
}
}
?>
</table>
</center>
</body>
</html>