(Find File) Code and Analysis -Week 4 Progress
<?php
include_once "include/header.php";
include_once "include/connect.php";
?>
• These lines include external PHP files: "header.php" and "connect.php". These files contain common code
snippets such as header informa:on and database connec:on details.
<!doctype html>
<html lang="en">
<head>
<<tle>Digital Parking Management System</<tle>
<!-- Required meta tags -->
<meta charset="uF-8">
<meta name="viewport" content="width=device-width, ini<al-scale=1, shrink-to-fit=no">
• This part is the HTML structure for the webpage. It sets the document type, language, and includes meta
tags for character encoding and viewport seDngs.
<!-- Bootstrap CSS -->
<link rel="stylesheet"
href="hPps://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-
ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin="anonymous">
<style>
.container{
margin-top:60px;
</style>
• This sec:on includes a Bootstrap CSS file and custom CSS for styling. It adds a margin to the top of
containers.
</head>
<body>
<<tle>Page Title</<tle>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, ini<al-scale=1">
<style>
/* Style the body */
body {
font-family: Arial;
margin: 0;
}
/* Header/Logo Title */
.header {
padding: 30px;
text-align: center;
background: #1abc9c;
color: white;
font-size: 30px;
}
/* Page Content */
.content {padding:20px;}
</style>
</head>
<body>
• This sec:on defines more CSS styles for the body, header, and content of the webpage.
<div class="header">
<h1>Bangladesh Railway</h1>
<p>Government of the People's Republic of Bangladesh</p>
</div>
• This is the header sec:on of the webpage displaying the :tle and a descrip:on.
<nav class="navbar navbar-expand-lg navbar navbar-dark bg-dark s<cky-top">
<!-- Naviga<on links -->
</nav>
• This part creates a naviga:on bar using Bootstrap classes.
<br>
<br>
• These are line breaks added for spacing.
<!-- Form -->
<h1 style="text-align: center; ">Find </h1>
<form ac<on="find1.php" method="post" align='center'>
<div class="container">
<hr>
<label for="Name "><b>Loca<ons : </b></label>
<select name="Name">
<op<on value="Basundhara">Basundhara </op<on>
<op<on value="UPara">UPara </op<on>
</select>
<input name="register" type="submit" class="btn btn-primary" value="Find">
</div>
</form>
• This is a form for finding loca:ons. It contains a dropdown menu for selec:ng loca:ons and a submit
buIon.
<body style="text-align:center;">
<div align="center">
• These lines seem redundant as the body and div tags are already opened above.
<?php
if(isset($_POST['register']))
{
$ = $_POST['Name '];
;
$sql = "SELECT * FROM list WHERE Name =('$Name ') AND date=('$date')";
• This PHP block checks if the form has been submiIed and retrieves the selected loca:on. Then, it
constructs an SQL query to select data from a table named "list" based on the selected loca:on and date.
if($result = mysqli_query($con, $sql)){
if(mysqli_num_rows($result) > 0){
echo "<table>";
echo "<tr>";
echo "<th>Name</th>";
echo "<th>Loca<on </th>";
echo "<th>Date</th>";
echo "</tr>";
while($row = mysqli_fetch_array($result)){
echo "<tr>";
echo "<td>" . $row['Number'] . "</td>";
echo "<td>" . $row['Name'] . "</td>";
echo "<td>" . $row['Loca<on '] . "</td>";
echo "<td>" . $row['Date'] . "</td>";
echo "</tr>";
}
echo "</table>";
// Free result set
mysqli_free_result($result);
} else{
echo "No records matching your query were found.";
}
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($con);
}
// Close connec<on
mysqli_close($con);
}
?>
• This PHP block executes the SQL query, retrieves data from the database, and displays it in a table format.
If no data is found, it displays an appropriate message. Finally, it closes the database connec:on.
</div>
<?php include_once "include/footer.php"; ?>
• This includes a footer file.
Overall, this code is to be a web page for a Digital Parking Management System. It includes HTML for the structure,
Bootstrap for styling, and PHP for server-side processing, querying a database, and displaying results.