Web Development Using PHP 225-UCS-032
Web Development Using PHP 225-UCS-032
Lab File
Web Development Using PHP Lab (CS 382)
Submitted By:
Branch: CSE-III-(A)
Group: 1
Submitted To:
UP (INDIA)
UI
Attendance Portal
Attendance Portal
UI code
UI Code
Team
Kunal Singh - 225/UCS/032
Priyanshu Chaudhary - 225/UCS/047
Index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Attendance Portal - Login</title>
<link rel="stylesheet" href="styles.css">
<link
href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&di
splay=swap" rel="stylesheet">
</head>
<body>
<div class="container">
<header>
<h1>Attendance Portal</h1>
</header>
<main>
<section class="login-form">
<h2>Login</h2>
<form action="#" method="post">
<div class="form-group">
<label for="username">Username</label>
<input type="text" id="username" name="username" required>
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" id="password" name="password" required>
</div>
<div class="form-group">
<label for="user-type">User Type</label>
<select id="user-type" name="user-type" required>
<option value="">Select user type</option>
<option value="student">Student</option>
<option value="teacher">Teacher</option>
<option value="parent">Parent</option>
<option value="admin">Admin</option>
</select>
</div>
<button type="submit" class="btn-primary">Login</button>
</form>
</section>
</main>
<footer>
<p>© 2025 Attendance Portal. All rights reserved.</p>
</footer>
</div>
</body>
</html>
AdminDashboard
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Dashboard - Attendance Portal</title>
<link rel="stylesheet" href="styles.css">
<link
href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&di
splay=swap" rel="stylesheet">
</head>
<body>
<div class="container">
<header>
<h1>Admin Dashboard</h1>
</header>
<main class="dashboard">
<aside class="sidebar">
<h2>Navigation</h2>
<ul>
<li><a href="#overview">Overview</a></li>
<li><a href="#users">Manage Users</a></li>
<li><a href="#reports">Reports</a></li>
<li><a href="#settings">Settings</a></li>
<li><a href="index.html">Logout</a></li>
</ul>
</aside>
<section class="main-content">
<h2>Welcome, Admin!</h2>
<div class="stats">
<div class="stat-card">
<h3>Total Students</h3>
<p>1,250</p>
</div>
<div class="stat-card">
<h3>Total Teachers</h3>
<p>75</p>
</div>
<div class="stat-card">
<h3>Average Attendance</h3>
<p>94%</p>
</div>
<div class="stat-card">
<h3>Active Users</h3>
<p>1,890</p>
</div>
</div>
<h3>Recent Activity</h3>
<table>
<thead>
<tr>
<th>Date</th>
<th>User</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td>2025-05-01</td>
<td>Teacher: John Smith</td>
<td>Marked attendance for Class 10A</td>
</tr>
<tr>
<td>2025-05-01</td>
<td>Admin: Jane Doe</td>
<td>Generated monthly attendance report</td>
</tr>
<tr>
<td>2025-04-30</td>
<td>Parent: Alice Johnson</td>
<td>Viewed child's attendance record</td>
</tr>
</tbody>
</table>
</section>
</main>
<footer>
<p>© 2025 Attendance Portal. All rights reserved.</p>
</footer>
</div>
</body>
</html>
Parent-dashboard
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Parent Dashboard - Attendance Portal</title>
<link rel="stylesheet" href="styles.css">
<link
href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&di
splay=swap" rel="stylesheet">
</head>
<body>
<div class="container">
<header>
<h1>Parent Dashboard</h1>
</header>
<main class="dashboard">
<aside class="sidebar">
<h2>Navigation</h2>
<ul>
<li><a href="#attendance">Attendance</a></li>
<li><a href="#grades">Grades</a></li>
<li><a href="#schedule">Schedule</a></li>
<li><a href="#communication">Communication</a></li>
<li><a href="index.html">Logout</a></li>
</ul>
</aside>
<section class="main-content">
<h2>Welcome, Parent!</h2>
<div class="stats">
<div class="stat-card">
<h3>Children</h3>
<p>2</p>
</div>
<div class="stat-card">
<h3>Average Attendance</h3>
<p>97%</p>
</div>
<div class="stat-card">
<h3>Upcoming Events</h3>
<p>3</p>
</div>
</div>
<h3>Children's Attendance</h3>
<table>
<thead>
<tr>
<th>Child</th>
<th>Grade</th>
<th>Attendance Rate</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td>John Doe</td>
<td>9th Grade</td>
<td>98%</td>
<td><button class="btn-primary">View Details</button></td>
</tr>
<tr>
<td>Jane Doe</td>
<td>7th Grade</td>
<td>96%</td>
<td><button class="btn-primary">View Details</button></td>
</tr>
</tbody>
</table>
</section>
</main>
<footer>
<p>© 2025 Attendance Portal. All rights reserved.</p>
</footer>
</div>
</body>
</html>
Student-dashboard
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Student Dashboard - Attendance Portal</title>
<link rel="stylesheet" href="styles.css">
<link
href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&di
splay=swap" rel="stylesheet">
</head>
<body>
<div class="container">
<header>
<h1>Student Dashboard</h1>
</header>
<main class="dashboard">
<aside class="sidebar">
<h2>Navigation</h2>
<ul>
<li><a href="#attendance">Attendance</a></li>
<li><a href="#schedule">Schedule</a></li>
<li><a href="#grades">Grades</a></li>
<li><a href="#profile">Profile</a></li>
<li><a href="index.html">Logout</a></li>
</ul>
</aside>
<section class="main-content">
<h2>Welcome, Student!</h2>
<div class="stats">
<div class="stat-card">
<h3>Attendance Rate</h3>
<p>95%</p>
</div>
<div class="stat-card">
<h3>Classes Today</h3>
<p>4</p>
</div>
<div class="stat-card">
<h3>Upcoming Tests</h3>
<p>2</p>
</div>
</div>
<h3>Recent Attendance</h3>
<table>
<thead>
<tr>
<th>Date</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<tr>
<td>2025-05-01</td>
<td>Present</td>
</tr>
<tr>
<td>2025-04-30</td>
<td>Present</td>
</tr>
<tr>
<td>2025-04-29</td>
<td>Absent</td>
</tr>
</tbody>
</table>
</section>
</main>
<footer>
<p>© 2025 Attendance Portal. All rights reserved.</p>
</footer>
</div>
</body>
</html>
Teacher-dashboard
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Teacher Dashboard - Attendance Portal</title>
<link rel="stylesheet" href="styles.css">
<link
href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&di
splay=swap" rel="stylesheet">
</head>
<body>
<div class="container">
<header>
<h1>Teacher Dashboard</h1>
</header>
<main class="dashboard">
<aside class="sidebar">
<h2>Navigation</h2>
<ul>
<li><a href="#attendance">Mark Attendance</a></li>
<li><a href="#classes">My Classes</a></li>
<li><a href="#reports">Reports</a></li>
<li><a href="#profile">Profile</a></li>
<li><a href="index.html">Logout</a></li>
</ul>
</aside>
<section class="main-content">
<h2>Welcome, Teacher!</h2>
<div class="stats">
<div class="stat-card">
<h3>Classes Today</h3>
<p>5</p>
</div>
<div class="stat-card">
<h3>Total Students</h3>
<p>120</p>
</div>
<div class="stat-card">
<h3>Average Attendance</h3>
<p>92%</p>
</div>
</div>
<h3>Today's Classes</h3>
<table>
<thead>
<tr>
<th>Time</th>
<th>Class</th>
<th>Room</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td>09:00 AM</td>
<td>Mathematics</td>
<td>Room 101</td>
<td><button class="btn-primary">Mark Attendance</button></td>
</tr>
<tr>
<td>11:00 AM</td>
<td>Physics</td>
<td>Room 203</td>
<td><button class="btn-primary">Mark Attendance</button></td>
</tr>
<tr>
<td>02:00 PM</td>
<td>Chemistry</td>
<td>Lab 3</td>
<td><button class="btn-primary">Mark Attendance</button></td>
</tr>
</tbody>
</table>
</section>
</main>
<footer>
<p>© 2025 Attendance Portal. All rights reserved.</p>
</footer>
</div>
</body>
</html>
Style.css
body {
font-family: "Poppins", sans-serif;
line-height: 1.6;
color: #333;
background-color: #f4f7f9;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
}
/* Header styles */
header {
background-color: #3498db;
color: #fff;
padding: 1rem 0;
text-align: center;
}
h1 {
font-size: 2.5rem;
font-weight: 600;
}
.login-form h2 {
font-size: 1.8rem;
margin-bottom: 1.5rem;
color: #2c3e50;
}
.form-group {
margin-bottom: 1.5rem;
}
label {
display: block;
margin-bottom: 0.5rem;
font-weight: 500;
color: #34495e;
}
input[type="text"],
input[type="password"],
select {
width: 100%;
padding: 0.75rem;
border: 1px solid #bdc3c7;
border-radius: 4px;
font-size: 1rem;
}
.btn-primary {
display: inline-block;
background-color: #3498db;
color: #fff;
padding: 0.75rem 1.5rem;
border: none;
border-radius: 4px;
font-size: 1rem;
cursor: pointer;
transition: background-color 0.3s ease;
}
.btn-primary:hover {
background-color: #2980b9;
}
/* Footer styles */
footer {
text-align: center;
padding: 1rem 0;
color: #7f8c8d;
font-size: 0.9rem;
}
/* Dashboard styles */
.dashboard {
display: grid;
grid-template-columns: 250px 1fr;
gap: 2rem;
}
.sidebar {
background-color: #2c3e50;
color: #ecf0f1;
padding: 2rem;
border-radius: 8px;
}
.sidebar h2 {
font-size: 1.5rem;
margin-bottom: 1.5rem;
}
.sidebar ul {
list-style-type: none;
}
.sidebar li {
margin-bottom: 1rem;
}
.sidebar a {
color: #ecf0f1;
text-decoration: none;
transition: color 0.3s ease;
}
.sidebar a:hover {
color: #3498db;
}
.main-content {
background-color: #fff;
border-radius: 8px;
padding: 2rem;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.main-content h2 {
font-size: 2rem;
margin-bottom: 1.5rem;
color: #2c3e50;
}
.stats {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 1.5rem;
margin-bottom: 2rem;
}
.stat-card {
background-color: #ecf0f1;
border-radius: 8px;
padding: 1.5rem;
text-align: center;
}
.stat-card h3 {
font-size: 1.2rem;
margin-bottom: 0.5rem;
color: #34495e;
}
.stat-card p {
font-size: 2rem;
font-weight: 600;
color: #3498db;
}
/* Responsive design */
@media (max-width: 768px) {
.dashboard {
grid-template-columns: 1fr;
}
.sidebar {
margin-bottom: 2rem;
}
}
Experiment 1
15-Jan-2025
Experiment-1
Requirements
Hardware
Software
1. Any operating system
2. Web browser
3. Text editor or IDE for coding
HTML Tags:
1. <!DOCTYPE html>: Specifies the document type and version of HTML being
used (HTML5).
2. <html>: The root tag that encapsulates all HTML content.
3. <head>: Contains metadata about the document such as the title and links to
external resources like CSS stylesheets.
4. <title>: Sets the title of the webpage, which appears on the browser tab.
5. <body>: Contains all the visible content of the webpage.
6. Headings (<h1> to <h6>): Used to define headings of different levels, where
<h1> is the largest and <h6> is the smallest.
7. Paragraph (<p>): Used for writing blocks of text content.
8. Line Break (<br>): Inserts a line break without starting a new paragraph.
9. Horizontal Rule (<hr>): Inserts a horizontal line to separate content.
10.Anchor Tag (<a>): Used to create hyperlinks. The href attribute specifies the
link's destination.
11.Bold and Italic (<strong> and <em>): <strong> makes text bold, and <em>
emphasizes text by italicizing it.
Table Tags:
Tables are used to display data in a structured tabular format with rows and columns.
Common Attributes:
Example:
<table border="1">
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>Kunal</td>
<td>21</td>
</tr>
</table>
List Tags:
Types of Lists:
Example:
<ul>
<li>Apple</li>
<li>Banana</li>
</ul>
<ol type="A">
<li>Math</li>
<li>Science</li>
</ol>
Image Tags:
Example:
Forms:
Example:
<label for="gender">Gender:</label>
<input type="radio" id="male" name="gender" value="male"> Male
<input type="radio" id="female" name="gender" value="female"> Female
Experiment-2
Requirements
Hardware
1. Windows/Linux/MacOS
Software
THEORY
Forms in HTML are used to collect user input. The <form> element contains various form
controls like text fields, radio buttons, checkboxes, and submit buttons. Frames allow
displaying multiple HTML documents in a single window, enhancing layout flexibility. CSS
is used to style the form for better user experience.
Code ➖
Html
<!DOCTYPE html>
<html>
<head>
<title>Registration Form</title>
</head>
<body>
<h2>Registration Form</h2>
<label for="email">Email:</label>
<label for="gender">Gender:</label>
<label for="hobbies">Hobbies:</label>
<label for="country">Country:</label>
<option value="India">India</option>
<option value="USA">USA</option>
<option value="UK">UK</option>
</select><br>
</form>
</body>
</html>
CSS
body {
margin: 20px;
background-color: #f4f4f4;
form {
background: white;
padding: 20px;
border-radius: 5px;
label {
font-weight: bold;
input,
select {
margin-bottom: 10px;
padding: 5px;
width: 100%;
Output
Experiment 3
29-Jan-2025
Experiment-3
Requirements
Hardware
Software
THEORY
A web server and an application server provide the necessary environment to host and run
web applications. Apache is a widely used web server that serves static and dynamic content.
Tomcat is an application server used to deploy Java-based applications. MySQL is an
open-source relational database management system, and PHP is a server-side scripting
language that interacts with databases.
Windows Installation:
🔗
Download the latest version of Apache HTTP Server from the official website:
https://httpd.apache.org/download.cgi
1. Run the installer (.msi file) and follow the setup instructions.
2. Configure the installation directory (e.g., C:\Apache24).
3. Modify the httpd.conf file (located in C:\Apache24\conf) to set the correct
document root: conf
2. Installing PHP
Windows Installation
🔗 https://www.php.net/downloads
1. Download the latest PHP version from:
ani.php
?>
3. Installing MySQL Database
MySQL is a relational database management system used for storing and managing website
data.
Windows Installation
🔗
1. Download MySQL Community Server from:
https://dev.mysql.com/downloads/mysql/
Tomcat is an open-source Java servlet container used to run Java-based web applications.
Windows Installation
2.
🔗
1. Download Apache Tomcat from:
https://tomcat.apache.org/download-90.cgi
Extract the downloaded .zip file (e.g., C:\Tomcat).
○
2. Restart Apache for changes to take effect.
Testing the Installation
if ($conn->connect_error) {
?>
Experiment-4
Aim :- To create an email system using PHP that allows users to register an
email ID, send, and receive pictures and documents.
Requirements
Hardware
Software
THEORY
Code
index.html
<html lang="en">
<head>
<title>Email System</title>
<style>
body {
background-color: #f4f4f4;
margin: 0;
padding: 0;
.form-container {
width: 50%;
background-color: #fff;
padding: 20px;
border-radius: 8px;
input,
textarea,
button {
width: 100%;
margin: 10px 0;
padding: 10px;
button {
background-color: #5cb85c;
color: white;
border: none;
border-radius: 4px;
button:hover {
background-color: #4cae4c;
</style>
</head>
<body>
<div class="form-container">
<input
type="text"
name="first_name"
placeholder="First Name"
required
/>
<input
type="email"
name="email"
placeholder="Recipient Email"
required
/>
<textarea name="message" placeholder="Your Message" required></textarea>
<input
type="file"
name="attachment"
accept="image/*,application/pdf,application/msword"
required
/>
</form>
</div>
</body>
</html>
Send_mail.php
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'vendor/autoload.php';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$firstName = $_POST['first_name'];
$lastName = $_POST['last_name'];
$mobile = $_POST['mobile'];
$email = $_POST['email'];
$message = $_POST['message'];
try {
//Server settings
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = '[email protected]';
$mail->Password = 'kxltztdjtovzmdlg';
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port = 587;
//Recipients
$mail->addAddress($email);
//Attachments
$mail->addAttachment($_FILES['file']['tmp_name'], $_FILES['file']['name']);
//Content
$mail->isHTML(true);
$mail->Subject = 'New Message from ' . $firstName . ' ' . $lastName;
$mail->send();
} else {
?>
Add phpmailer
Start XAMPP
Output
Experiment 5
29-Jan-2025
Experiment-5
Aim :- To create a simple web file to demonstrate the use of different tags.
Requirements
Hardware
Software
Code
1. Login.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Login Page</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<div>
ID</label>
focus:ring-blue-500" required>
</div>
<div>
text-gray-700">Password</label>
focus:ring-blue-500" required>
</div>
<div class="text-right">
hover:text-blue-700">Forgot Password?</a>
</div>
<div>
Login
</button>
</div>
<div class="text-center">
</div>
</form>
</div>
</body>
</html>
Output
2. forgotpassword.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Forgot Password</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
Background -->
28
<form class="space-y-6">
<div>
ID</label>
focus:ring-blue-500" required>
</div>
<div>
Reset Password
</button>
</div>
<div class="text-center">
</div>
</form>
</div>
</body>
</html>
Output
3.registration.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Registration Form</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<div class="space-y-4">
<div>
30
Name</label>
focus:ring-blue-500" required>
</div>
<div>
<label for="lastName" class="block text-sm font-medium text-gray-700">Last
Name</label>
focus:ring-blue-500" required>
</div>
<div>
Roll No.</label>
focus:ring-blue-500" required>
</div>
<div>
text-gray-700">School Name</label>
focus:ring-blue-500" required>
31
<option value="School of Arts">School of Arts</option>
</select>
</div>
<div>
text-gray-700">Course Name</label>
</div>
</div>
<div class="space-y-4">
<div>
text-gray-700">Specialization</label>
</div>
<div>
<label for="email" class="block text-sm font-medium
text-gray-700">Email</label>
focus:ring-blue-500" required>
</div>
32
<div>
No.</label>
focus:ring-blue-500" required>
</div>
<div>
text-blue-500" required>
<span class="ml-2">Male</span>
</label>
text-blue-500" required>
<span class="ml-2">Female</span>
</label>
text-blue-500" required>
<span class="ml-2">Other</span>
</label>
</div>
</div>
33
<div>
text-gray-700">Category</label>
focus:ring-blue-500" required>
<option value="General">General</option>
<option value="OBC">OBC</option>
<option value="SC">SC</option>
<option value="ST">ST</option>
</select>
</div>
</div>
<div>
text-gray-700">Father's Name</label>
</div>
<div>
34
</div>
</div>
Submit
</button>
</div>
</div>
</form>
</div>
</body>
</html>
Output
4.dashboard.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Dashboard</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<ul class="space-y-4">
<li>
</li>
<li>
</li>
<li>
</li>
<li>
<li>
36
</li>
</ul>
<div class="mt-8">
</div>
</div>
class="text-blue-500">Sam</span>!</h1>
</div>
<ul class="space-y-3">
</div>
37
<ul class="space-y-3">
</ul>
</div>
</div>
</body>
</html>
Output
Experiment 6
29-Jan-2025
Experiment-5
Aim :- To create an html web with different types of frames such as navigation
frame, floating frame & mixed frame.
Requirements
Hardware
Software
Code
Index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Attendance Portal</title>
</head>
<frameset rows="15%, 75%, 10%" border="0">
<!-- Top Frame (Header) -->
<frame src="header.html" name="headerFrame" scrolling="no" noresize>
<frameset cols="20%, 60%, 20%">
<!-- Left Navigation Frame -->
<frame src="navbar.html" name="navFrame" noresize>
<!-- Main Content Frame -->
39
<frame src="home.html" name="mainFrame">
<!-- Floating Notices Frame -->
<frame src="notices.html" name="noticesFrame" scrolling="no">
</frameset>
<!-- Footer Frame -->
<frame src="footer.html" name="footerFrame" scrolling="no" noresize>
</frameset>
</html>
Home.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home - Attendance Portal</title>
<style>
body {
font-family: 'Arial', sans-serif;
background-color: #f4f4f9;
margin: 0;
padding: 20px;
color: #333;
}
.welcome-message {
text-align: center;
margin-bottom: 30px;
}
40
.welcome-message h1 {
font-size: 2.5em;
color: #4CAF50;
}
.welcome-message p {
font-size: 1.2em;
color: #666;
}
.dashboard {
display: flex;
justify-content: space-between;
gap: 20px;
}
.card {
background: white;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
padding: 20px;
flex: 1;
text-align: center;
transition: transform 0.3s ease;
}
.card:hover {
transform: translateY(-10px);
}
.card h2 {
font-size: 1.5em;
41
color: #4CAF50;
margin-bottom: 10px;
}
.card p {
font-size: 1em;
color: #666;
}
.calendar {
background: white;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
padding: 20px;
flex: 1;
}
.calendar h2 {
font-size: 1.5em;
color: #4CAF50;
margin-bottom: 20px;
}
.progress-bar {
background: white;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
padding: 20px;
flex: 1;
}
.progress-bar h2 {
42
font-size: 1.5em;
color: #4CAF50;
margin-bottom: 20px;
}
.progress-container {
background: #e0e0e0;
border-radius: 10px;
overflow: hidden;
height: 20px;
}
.progress {
background: #4CAF50;
height: 100%;
width: 75%; /* Adjust this value dynamically */
border-radius: 10px;
text-align: center;
color: white;
line-height: 20px;
font-size: 0.8em;
}
</style>
</head>
<body>
<div class="welcome-message">
<h1>Welcome, Sam!</h1>
<p>Manage your attendance, track progress, and stay organized with our easy-to-use
tools.</p>
43
</div>
<div class="dashboard">
<!-- Quick Action Cards -->
<div class="card">
<h2>Mark Attendance</h2>
<p>Quickly mark your attendance for today.</p>
</div>
<div class="card">
<h2>View Reports</h2>
<p>Check your attendance history and reports.</p>
</div>
<div class="card">
<h2>Upcoming Events</h2>
<p>Stay updated with upcoming events and deadlines.</p>
</div>
</div>
<div class="dashboard" style="margin-top: 20px;">
<!-- Calendar Section -->
<div class="calendar">
<h2>Calendar</h2>
<iframe
src="https://calendar.google.com/calendar/embed?src=en.usa%23holiday%40group.v.calen
da
r.google.com&ctz=America%2FNew_York"
style="border: 0; width: 100%; height: 300px;"
frameborder="0"
scrolling="no">
</iframe>
</div>
44
<!-- Progress Bar Section -->
<div class="progress-bar">
<h2>Attendance Progress</h2>
<div class="progress-container">
<div class="progress" style="width: 75%;">75%</div>
</div>
<p>You have attended 75% of the sessions this month.</p>
</div>
</div
</body>
</html>
Header.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Header</title>
<link rel="stylesheet" href="style.css">
</head>
<body class="header">
<h1>Student Attendance Portal</h1>
</body>
</html>
Footer.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Footer</title>
45
<link rel="stylesheet" href="style.css">
</head>
<body class="footer">
<p>© 2025 Attendance Portal | All rights reserved.</p>
</body>
</html>
Attendance.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Attendance</title>
<link rel="stylesheet" href="style.css">
</head>
<body class="content">
<h2>Attendance Records</h2>
<table border="1">
<tr>
<th>Student Name</th>
<th>Roll Number</th>
<th>Status</th>
</tr>
<tr>
<td>Leo Luo</td>
<td>2k22/UCS/001</td>
<td>Present</td>
</tr>
<tr>
46
<td>Jane Smith</td>
<td>2k22/UCS/002</td>
<td>Absent</td>
</tr>
</table>
</body>
</html>
Contact.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Contact</title>
<link rel="stylesheet" href="style.css">
</head>
<body class="content">
<h2>Contact Us</h2>
<p>Email: [email protected]</p>
<p>Phone: +123 456 7890</p>
</body>
</html>
Navbar.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Navigation</title>
<link rel="stylesheet" href="style.css">
</head>
47
<body class="navbar">
<h3>Menu</h3>
<ul>
<li><a href="home.html" target="mainFrame">Home</a></li>
<li><a href="attendance.html" target="mainFrame">Attendance</a></li>
<li><a href="students.html" target="mainFrame">Students</a></li>
<li><a href="contact.html" target="mainFrame">Contact</a></li>
</ul>
</body>
</html>
Notices.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Navigation</title>
<link rel="stylesheet" href="style.css">
</head>
<body class="navbar">
<h3>Menu</h3>
<ul>
<li><a href="home.html" target="mainFrame">Home</a></li>
<li><a href="attendance.html" target="mainFrame">Attendance</a></li>
<li><a href="students.html" target="mainFrame">Students</a></li>
<li><a href="contact.html" target="mainFrame">Contact</a></li>
</ul>
</body>
</html>
Students.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Students</title>
<link rel="stylesheet" href="style.css">
</head>
<body class="content">
<h2>Registered Students</h2>
<ul>
<li>Leo Luo- Roll No: 2k22/UCS/001</li>
<li>Jane Smith - Roll No: 2k22/UCS/002</li>
<li>Michael Johnson - Roll No: 2k22/UCS/003</li>
</ul>
</body>
</html>
Style.css
<!DOCTYPE html>
<html lang="en">
<head>
<title>Students</title>
<link rel="stylesheet" href="style.css">
</head>
<body class="content">
<h2>Registered Students</h2>
<ul>
<li>Leo Luo- Roll No: 2k22/UCS/001</li>
49
<li>Jane Smith - Roll No: 2k22/UCS/002</li>
<li>Michael Johnson - Roll No: 2k22/UCS/003</li>
</ul>
</body>
</html>
OUTPUT:
Dashboard
Attendance record
Contact page
Experiment 7
2-Apr-2025
Experiment-7
Requirements
Hardware
Software
Code
index.php
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
session_start();
if (!isset($_SESSION['views'])) {
$_SESSION['views'] = 0;
}
// Increment the page view count
$_SESSION['views']++;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
body {
text-align: center;
margin: 50px;
background-color: #f4f4f4;
.counter-box {
background: white;
width: 400px;
margin: 0 auto;
padding: 45px;
border-radius: 10px;
.reset-btn {
margin-top: 15px;
background-color: red;
color: white;
border: none;
cursor: pointer;
border-radius: 5px;
.reset-btn:hover {
background-color: darkred;
.qwert {
text-align: left;
margin: 2px 0;
.tutu {
font-size: 18px;
margin-bottom: 1px;
input[type="text"] {
width: 100%;
padding: 10px;
border-radius: 5px;
</style>
</head>
<body>
<div class="counter-box">
<div class="qwert">
<p class="tutu">Name</p>
<p class="tutu">Email</p>
<p class="tutu">Phone</p>
<p class="tutu">Address</p>
</div>
<button class="reset-btn" type="submit">Reset Count</button>
</form>
</div>
</body>
</html>
reset.php
<?php
session_start();
exit();
?>
Output
Experiment 8
9-Apr-2025
Experiment-8
Requirements
Hardware
Software
Code
Visit.php
<?php
// PHP Logic Part
// Message to display
🕒
if (isset($_COOKIE[$cookie_name])) {
$message = " Last visited on: " . $_COOKIE[$cookie_name];
} else {
$message = "👋 This is your first visit!";
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Last Visit Tracker</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: #f0f4f8;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.container {
background: white;
padding: 30px 50px;
border-radius: 15px;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
text-align: center;
}
h1 {
color: #333;
margin-bottom: 20px;
}
p{
font-size: 1.2rem;
color: #555;
}
</style>
</head>
<body>
<div class="container">
<h1>Welcome Back!</h1>
<p><?php echo $message; ?></p>
</div>
</body>
</html>
Output
Experiment 9
16-Apr-2025
Experiment-9
Aim :- Create an XHTML form with Name, Address Line 1, Address Line 2,
and E-mail text fields. On submitting, store the values in MySQL table. Retrieve
and display the data based on Name.
Requirements
Hardware
Software
Code
index.php
h2 {
text-align: center;
color: #333;
}
label {
display: block;
margin-bottom: 8px;
font-weight: bold;
color: #444;
}
input[type="text"],
input[type="email"] {
width: 100%;
padding: 10px;
margin-bottom: 20px;
border: 2px solid #ddd;
border-radius: 8px;
transition: border-color 0.3s ease;
}
input[type="text"]:focus,
input[type="email"]:focus {
border-color: #74ebd5;
outline: none;
}
input[type="submit"] {
padding: 10px 20px;
margin-right: 10px;
border: none;
border-radius: 8px;
background-color: #4CAF50;
color: white;
font-weight: bold;
cursor: pointer;
transition: background-color 0.3s ease;
}
input[type="submit"]:hover {
background-color: #45a049;
}
.result {
margin-top: 20px;
padding: 15px;
background-color: #f3f3f3;
border-radius: 10px;
}
.result h3 {
margin-top: 0;
}
</style>
</head>
<body>
<div class="form-container">
<h2>User Information Form</h2>
<form method="post" action="index.php">
<label>Name:</label>
<input type="text" name="name" required />
<label>Email:</label>
<input type="email" name="email" required />
<div class="result">
<?php
// Step 2: Connect to MySQL
$conn = new mysqli("localhost", "root", "", "userdb");
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Step 2: On Submit
if (isset($_POST['submit'])) {
$name = $_POST['name'];
$address1 = $_POST['address1'];
$address2 = $_POST['address2'];
$email = $_POST['email'];
// Step 3: On Search
if (isset($_POST['search'])) {
$name = $_POST['name'];
$stmt = $conn->prepare("SELECT * FROM users WHERE name = ?");
$stmt->bind_param("s", $name);
$stmt->execute();
$result = $stmt->get_result();
$stmt->close();
}
$conn->close();
?>
</div>
</div>
</body>
</html>
User.sql
-- Create database
CREATE DATABASE IF NOT EXISTS userdb;
USE userdb;
-- Create table
CREATE TABLE IF NOT EXISTS users (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
address1 VARCHAR(255),
address2 VARCHAR(255),
email VARCHAR(100)
);
Experiment-10
Aim :- Create an XHTML form with Name, Address Line 1, Address Line 2,
and E-mail text fields. On submitting, store the values in MySQL table. Retrieve
and display the data based on Name.
Requirements
Hardware
Software
Code
index.php
<!DOCTYPE html>
<html>
<head>
<title>Book Information Form</title>
<meta charset="UTF-8" />
<style>
body {
font-family: Arial, sans-serif;
background: linear-gradient(to right, #ffecd2, #fcb69f);
margin: 0;
padding: 40px;
display: flex;
justify-content: center;
}
.form-container {
background-color: #fff;
padding: 30px 40px;
border-radius: 12px;
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
width: 500px;
}
h2 {
text-align: center;
color: #333;
}
label {
display: block;
margin: 10px 0 5px;
font-weight: bold;
}
input[type="text"] {
width: 100%;
padding: 10px;
border: 2px solid #ccc;
border-radius: 6px;
}
input[type="submit"] {
padding: 10px 20px;
margin-top: 15px;
margin-right: 10px;
border: none;
border-radius: 6px;
background-color: #3498db;
color: white;
font-weight: bold;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #2980b9;
}
.result {
margin-top: 30px;
background-color: #f9f9f9;
padding: 20px;
border-radius: 10px;
}
.result h3 {
margin-top: 0;
}
</style>
</head>
<body>
<div class="form-container">
<h2>Book Information Form</h2>
<form method="post" action="">
<label>Accession Number:</label>
<input type="text" name="accession" required />
<label>Title:</label>
<input type="text" name="title" required />
<label>Authors:</label>
<input type="text" name="authors" required />
<label>Edition:</label>
<input type="text" name="edition" required />
<label>Publisher:</label>
<input type="text" name="publisher" required />
<div class="result">
<?php
// Step 2: Connect to MySQL
$conn = new mysqli("localhost", "root", "", "library");
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$stmt->close();
}
$conn->close();
?>
</div>
</div>
</body>
</html>
library.sql
Output