Megh WD
Megh WD
: 220840116069
PRACTICAL – 1
AIM: Design webpage using a simple HTML.
1.1: WAP in html containing following tag
• <h1 to h6> </h1 to /h6>
• <p> </p>
• <br> and <hr>
• nbsp;
Code: <!DOCTYPE html>
<html lang="en">
<head>
<title>Prac 1.1</title>
</head>
<body bgcolor="cyan">
<!-- Heading tags from h1 to h6 -->
<h1>R N G Patel Institute of Technology</h1>
<h2>R N G Patel Institute of Technology</h2>
<h3>R N G Patel Institute of Technology</h3>
<h4>R N G Patel Institute of Technology</h4>
<h5>R N G Patel Institute of Technology</h5>
<h6>R N G Patel Institute of Technology</h6>
1
Enrolment No.: 220840116069
OUTPUT
2
Enrolment No.: 220840116069
OUTPUT
4
Enrolment No.: 220840116069
</body>
</html>
5
Enrolment No.: 220840116069
OUTPUT
6
Enrolment No.: 220840116069
7
Enrolment No.: 220840116069
OUTPUT
8
Enrolment No.: 220840116069
1.5 WAP in html which demonstrates color and back ground facility.
Code: <!DOCTYPE html>
<html lang="en">
<head>
<title>HTML Color and Background Example</title>
<style>
body {
background-color: cyan; /* Light blue background */
color: #333; /* Dark text color */
font-family: Arial, sans-serif;
}
h1 {
color: #ff6347; /* Tomato color for heading */
}
p{
background-color: #e0ffff; /* Light cyan background for paragraphs */
padding: 10px;
border: 1px solid #ccc; /* Light gray border */
}
.highlight {
background-color: yellow; /* Highlighted text */
color: red; /* Red text color */
}
</style>
</head>
<body>
<h1>Color and Background Demonstration</h1>
<p>This is a paragraph with a light cyan background and dark text color.</p>
<p class="highlight">This paragraph is highlighted with a yellow background and
red text color.</p>
<p style="background-color: lightgreen; color: darkgreen;">This paragraph uses
inline styles for a light green background and dark green text color.</p>
</body>
</html>
9
Enrolment No.: 220840116069
OUTPUT
10
Enrolment No.: 220840116069
1.6 WAP in html which demonstrate anchor tag and href attribute to link
up a page.
Code: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Anchor Tag Example</title>
</head>
<body bgcolor="cyan">
<h1>Anchor Tag and Href Attribute Demonstration</h1>
11
Enrolment No.: 220840116069
OUTPUT
12
Enrolment No.: 220840116069
<p>Click on the computer, the phone, or the cup of coffee to go to a new page
and read more about the topic:</p>
<map name="workmap">
<area shape="rect" coords="34,44,270,350" alt="Computer"
href="computer.htm">
<area shape="rect" coords="290,172,333,250" alt="Phone"
href="phone.htm">
<area shape="circle" coords="337,300,44" alt="Cup of coffee"
href="coffee.htm">
</map>
</body>
</html>
13
Enrolment No.: 220840116069
OUTPUT
14
Enrolment No.: 220840116069
1.8 WAP in html to demonstrate practical list document using fully <table>
tag.
Code: <!DOCTYPE html>
<html lang="en">
<head>
<title>Table tag</title>
</head>
<body align="center" bgcolor="cyan">
<h1>Practical List Document</h1>
15
Enrolment No.: 220840116069
</tfoot>
</table>
</body>
</html>
OUTPUT
16
Enrolment No.: 220840116069
<noframes>
<body>
<p>Your browser does not support frames. Here is the content
instead:</p>
<p>This is the content that would be displayed if frames were not
supported.</p>
</body>
</noframes>
</frameset>
17
Enrolment No.: 220840116069
OUTPUT
18
Enrolment No.: 220840116069
PRACTICAL – 2
AIM: Design student Time Table using HTML tag.
Code: <!DOCTYPE html>
<html>
<head>
<title> Prac 2 </title>
</head>
<body bgcolor="cyan">
<table border="1px" align="center">
<tr>
<th colspan="14"> R. N. G. Patel Institute of Technology </th>
</tr>
<tr>
<th rowspan="3" height="100" width="100"> <img
src="c:\Users\neelp\Downloads\RNGPIT.jpg"> </th>
<th colspan="10"> Class Time Table </th>
<th rowspan="=2" colspan="4"> Date : 06/01/2024 </th>
</tr>
<tr>
<th colspan="10"> Dept:Information Technology(IT)</th>
<th rowspan="2" colspan="2"> Page: 01 of 01 </th>
</tr>
<tr>
<th colspan="10"> Program : B.E. IT</th>
</tr>
<tr>
<th colspan="4"> Duration/Term : 01-February-2024 to 25-May-2024</th>
<th colspan="6"> Class:- IT-22/Sem-5th</th>
<th colspan="4"> Room No.: C-007</th>
</tr>
<tr>
<th> Sr. No.</th>
<th> Time </th>
<th colspan="2"> MONDAY</th>
<th colspan="2"> TUESDAY</th>
<th colspan="2"> WEDNESDAY</th>
<th colspan="2"> THURSDAY</th>
<th colspan="2"> FRIDAY</th>
<th colspan="2"> SATURDAY</th>
</tr>
<tr>
<th rowspan="2">1</th>
<th rowspan="2">10:00 to 11:00</th>
<td rowspan="2" colspan="2">ADA (KND) </td>
19
Enrolment No.: 220840116069
20
Enrolment No.: 220840116069
<tr>
<th rowspan="2">5</th>
<th rowspan="2">03:00 to 04:00</th>
<td rowspan="2" colspan="2"> CS (PPV) </td>
<td rowspan="4" colspan="2"> WD (HAP) B-221 / CS (PPV) B-222 </td>
<td rowspan="2" colspan="2"> CN (VCJ) </td>
<td rowspan="4" colspan="2"> CS (PPV) B-221 / WD (MRG) B-222 </td>
<td rowspan="2" colspan="2"> CS (PPV) </td>
<td rowspan="4" colspan="2"> DE (KND) B-221 / DE (VCJ) B-222 </td>
</tr>
<tr></tr>
<tr>
<th rowspan="2">6</th>
<th rowspan="2">04:00 to 05:00</th>
<td rowspan="2" colspan="2"> IPDC (HJK) </td>
<td rowspan="2" colspan="2"> PE (APM) </td>
<td rowspan="2" colspan="2"> DA (HAP) </td>
</tr>
</table>
</body>
</html>
21
Enrolment No.: 220840116069
OUTPUT
22
Enrolment No.: 220840116069
PRACTICAL – 3
AIM: Design HTML form for the student registration application.
Code: <!DOCTYPE html>
<html>
<head>
<title> Prac 3 </title>
</head>
<body bgcolor="cyan">
<h1 align="center"> STUDENT REGISTRATION FORM </h1>
<form>
<table border="1px" align="center" cellpadding="5px">
<tr>
<th> FULL NAME</th>
<td> <label for="fullname"> </label>
<input type="text" name="fullname" required>
(max 30 characters A-Z,a-z)
</td>
</tr>
<tr>
<th> DATE OF BIRTH </th>
<td> <label for="dob"></label>
<select name="dob" id="dob" required>
<option name="dd">DD</option>
<option name="dd">1</option>
<option name="dd">2</option>
<option name="dd">3</option>
<option name="dd">4</option>
<option name="dd">5</option>
<option name="dd">6</option>
<option name="dd">7</option>
<option name="dd">8</option>
<option name="dd">9</option>
<option name="dd">10</option>
<option name="dd">11</option>
<option name="dd">12</option>
<option name="dd">13</option>
<option name="dd">14</option>
<option name="dd">15</option>
<option name="dd">16</option>
<option name="dd">17</option>
<option name="dd">18</option>
<option name="dd">19</option>
<option name="dd">20</option>
<option name="dd">21</option>
<option name="dd">22</option>
23
Enrolment No.: 220840116069
<option name="dd">23</option>
<option name="dd">24</option>
<option name="dd">25</option>
<option name="dd">26</option>
<option name="dd">27</option>
<option name="dd">28</option>
<option name="dd">29</option>
<option name="dd">30</option>
<option name="dd">31</option>
</select>
<select name="dob" id="dob">
<option name="mm">MM</option>
<option name="mm">JAN</option>
<option name="mm">FEB</option>
<option name="mm">MAR</option>
<option name="mm">APR</option>
<option name="mm">MAY</option>
<option name="mm">JUN</option>
<option name="mm">JUL</option>
<option name="mm">AUG</option>
<option name="mm">SEP</option>
<option name="mm">OCT</option>
<option name="mm">NOV</option>
<option name="mm">DEC</option>
</select>
<select name="dob" id="year">
<option name="dd">YYYY</option>
<option name="dd">2001</option>
<option name="dd">2002</option>
<option name="dd">2003</option>
<option name="dd">2004</option>
</select>
</td>
</tr>
<tr>
<th> EMAIL </th>
<td> <label for="email"></label>
<input type="email" name="email" required>
([email protected])
</td>
</tr>
<tr></tr>
<th> MOBILE NUMBER</th>
<td> <label for="mobile"></label>
<input type="tel" id="mobile" name="mobile" required>
(10 digit only)
24
Enrolment No.: 220840116069
</td>
</tr>
<tr>
<th> GENDER </th>
<td> <label for="gender">MALE</label>
<input type="radio" id="male" name="gender" value="male">
<label for="gender">FEMALE</label>
<input type="radio" id="female" name="gender" value="female">
</td>
</tr>
<tr>
<th> ADDRESS</th>
<td> <label for="address"></label>
<textarea id="address" name="address" row="4" cols="20" required>
</textarea>
</td>
</tr>
<tr>
<th> HOBBIES </th>
<td> <label for="hobbies">Driving</label>
<input type="radio" id="hobbies" name="hobbies" value="Driving">
<label for="hobbies">Singing</label>
<input type="radio" id="hobbies" name="hobbies" value="Singing">
<label for="hobbies">Dancing</label>
<input type="radio" id="hobbies" name="hobbies"
value="Dancing">
<label for="hobbies">Sketching</label>
<input type="radio" id="hobbies" name="hobbies"
value="Sketching">
</td>
</tr>
<tr>
<th> DOCUMENTS </th>
<td>
<input type="file" id="document" accept="pdf">
</td>
</tr>
<tr>
<th colspan="2">
<input type="submit" name="submit">
<input type="reset" name="reset">
</th>
</tr>
</table>
</form>
</body>
25
Enrolment No.: 220840116069
</html>
OUTPUT
26
Enrolment No.: 220840116069
PRACTICAL – 4
AIM: Design HTML Page using various tags of HTML5.
Code: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Prac 4</title>
<link
href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=
swap" rel="stylesheet">
<style>
body {
font-family: 'Roboto', sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
color: #333;
}
header {
background-color: #000;
color: #fff;
padding: 20px 0;
text-align: center;
position: sticky;
top: 0;
z-index: 1000;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
nav {
display: flex;
justify-content: center;
background-color: #333;
}
nav a {
color: #fff;
padding: 14px 20px;
text-decoration: none;
text-align: center;
transition: background-color 0.3s;
}
nav a:hover {
background-color: #575757;
}
.container {
27
Enrolment No.: 220840116069
padding: 20px;
}
.hero {
background-image: url('https://images.hdqwalls.com/wallpapers/2020-bmw-
m8-competition-rear-view-5k-nm.jpg');
background-size: cover;
background-position: center;
height: 500px;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
text-align: center;
position: relative;
overflow: hidden;
}
.hero::after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
}
.hero h1 {
font-size: 4em;
margin: 0;
z-index: 1;
animation: fadeInDown 1s ease-out;
}
.hero p {
font-size: 1.5em;
z-index: 1;
animation: fadeInUp 1s ease-out;
}
@keyframes fadeInDown {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
28
Enrolment No.: 220840116069
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.features, .specifications {
margin: 20px 0;
}
.features ul, .specifications table {
width: 100%;
margin: 0 auto;
}
.features ul {
list-style-type: none;
padding: 0;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px;
}
.features li {
background-color: #fff;
padding: 20px;
border: 1px solid #ddd;
transition: transform 0.3s, box-shadow 0.3s;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.features li:hover {
transform: translateY(-10px);
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}
.specifications table {
border-collapse: collapse;
width: 100%;
}
.specifications th, .specifications td {
border: 1px solid #ddd;
padding: 10px;
text-align: left;
}
.specifications th {
background-color: #f2f2f2;
29
Enrolment No.: 220840116069
}
.car-image {
text-align: center;
margin: 20px 0;
}
.car-image img {
max-width: 100%;
height: auto;
transition: transform 0.3s;
}
.car-image img:hover {
transform: scale(1.05);
}
footer {
background-color: #000;
color: #fff;
text-align: center;
padding: 10px 0;
position: fixed;
width: 100%;
bottom: 0;
}
.contact-form {
display: flex;
flex-direction: column;
align-items: center;
}
.contact-form label {
margin: 10px 0 5px;
}
.contact-form input, .contact-form textarea {
width: 80%;
padding: 10px;
margin: 5px 0;
border: 1px solid #ddd;
border-radius: 5px;
}
.contact-form button {
padding: 10px 20px;
margin: 10px 0;
border: none;
background-color: #007bff;
color: white;
cursor: pointer;
transition: background-color 0.3s;
}
30
Enrolment No.: 220840116069
.contact-form button:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<header>
<h1>BMW</h1>
</header>
<nav>
<a href="#home">Home</a>
<a href="#features">Features</a>
<a href="#specifications">Specifications</a>
<a href="#gallery">Gallery</a>
<a href="#contact">Contact</a>
</nav>
<div class="container">
<section id="home" class="hero">
<h1>Welcome to BMW</h1>
<p>Experience the ultimate driving machine.</p>
</section>
<section id="features" class="features">
<h2>Features</h2>
<ul>
<li>Advanced Safety Systems</li>
<li>Luxurious Interiors</li>
<li>Powerful Engine</li>
<li>Innovative Technology</li>
</ul>
</section>
<section id="specifications" class="specifications">
<h2>Specifications</h2>
<table>
<tr>
<th>Engine</th>
<td>3.0L Twin-Turbo Inline-6</td>
</tr>
<tr>
<th>Horsepower</th>
<td>382 hp</td>
</tr>
<tr>
<th>Torque</th>
<td>369 lb-ft</td>
</tr>
<tr>
31
Enrolment No.: 220840116069
<th>0-60 mph</th>
<td>4.1 seconds</td>
</tr>
</table>
</section>
<section id="gallery" class="car-image">
<h2>Gallery</h2>
<img src="https://images.hdqwalls.com/wallpapers/bthumb/2020-bmw-m8-
competition-coupe-side-view-5k-kf.jpg" alt="BMW M8 Competition">
<img src="https://images.hdqwalls.com/wallpapers/bthumb/2020-bmw-m8-
competition-coupe-5k-mc.jpg" alt="BMW M8 Competition">
<img src="https://images.hdqwalls.com/wallpapers/bmw-m8-competition-
coupe-5k-fn.jpg" alt="BMW M8 Competition">
</section>
<section id="contact">
<h2>Contact Us</h2>
<form class="contact-form">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="message">Message:</label>
<textarea id="message" name="message" rows="4" required></textarea>
<button type="submit">Submit</button>
</form>
</section>
</div>
<footer>
<p>© 2024 BMW. All rights reserved.</p>
</footer>
</body>
</html>
32
Enrolment No.: 220840116069
OUTPUT
33
Enrolment No.: 220840116069
34
Enrolment No.: 220840116069
PRACTICAL – 5
AIM: Develop HTML Page using CSS.
5.1: Internal (It should include cover image, color, text, font, border, box,
and margin).
Code: <!DOCTYPE html>
<html>
<head>
<title>Mustang GT</title>
<style>
body {
background-color: #f0f0f0;
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
.header {
background-color: #333;
color: #fff;
padding: 20px;
text-align: center;
}
.header a {
color: #fff;
text-decoration: none;
}
.header a:hover {
color: #ccc;
}
.navbar {
background-color: #444;
padding: 10px;
text-align: center;
}
.navbar a {
color: #fff;
text-decoration: none;
margin: 0 20px;
}
35
Enrolment No.: 220840116069
.navbar a:hover {
color: #ccc;
}
.cover-image {
background-image: url('https://images.hdqwalls.com/wallpapers/red-ford-
mustang-shelby-gt-500-ky.jpg');
background-size: cover;
background-position: center;
height: 100vh;
width: 100vw;
display: flex;
justify-content: center;
align-items: center;
color: #fff;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}
.cover-image h1 {
font-size: 64px;
font-weight: bold;
margin-top: 10px;
text-align: center;
}
.cover-image p {
font-size: 24px;
margin-bottom: 50px;
text-align: center;
}
.box {
background-color: #fff;
padding: 20px;
border: 1px solid #ddd;
margin: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
border-radius: 10px;
}
.box h2 {
font-size: 24px;
font-weight: bold;
margin-bottom: 10px;
color: #333;
}
36
Enrolment No.: 220840116069
.box p {
font-size: 18px;
margin-bottom: 20px;
color: #666;
}
.margin {
margin: 20px;
}
.button {
background-color: #337ab7;
color: #fff;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
}
.button:hover {
background-color: #23527c;
}
.footer {
background-color: #333;
color: #fff;
padding: 20px;
text-align: center;
clear: both;
}
.footer a {
color: #fff;
text-decoration: none;
}
.footer a:hover {
color: #ccc;
}
</style>
</head>
<body>
<div class="header">
<h1>Mustang GT</h1>
</div>
37
Enrolment No.: 220840116069
<div class="navbar">
<a href="#">Home</a>
<a href="#">Features</a>
<a href="#">Design</a>
<a href="#">Safety</a>
<a href="#">Contact</a>
</div>
<div class="cover-image">
<h1>Mustang GT</h1>
<p>The ultimate driving machine, with a powerful 5.0L V8 engine and 460
horsepower.</p>
<button class="button">Learn More</button>
</div>
<div class="box margin">
<h2>Performance</h2>
<p>The Mustang GT is equipped with a 6-speed manual transmission, rear-
wheel drive, and a sport-tuned suspension.</p>
<p>It can go from 0-60mph in just 4.3 seconds, making it a thrill to
drive.</p>
</div>
<div class="box margin">
<h2>Design</h2>
<p>The Mustang GT has a sleek and aggressive design, with a bold front
grille, LED headlights, and a sloping roofline.</p>
<p>The interior features premium materials, including leather-trimmed seats
and a heated steering wheel.</p>
</div>
<div class="box margin">
<h2>Safety Features</h 2>
<p>The Mustang GT comes with a range of safety features, including:</p>
<ul>
<li>Forward collision warning</li>
<li>Automatic emergency braking</li>
<li>Blind spot monitoring</li>
<li>Lane departure warning</li>
</ul>
</div>
<div class="footer">
<p>© 2023 Mustang GT</p>
<a href="#">Terms of Service</a>
<a href="#">Privacy Policy</a>
</div>
</body>
</html>
38
Enrolment No.: 220840116069
OUTPUT
39
Enrolment No.: 220840116069
5.2: External (It should include cover image, color, text, font, border, box,
and margin).
Code: <!DOCTYPE html>
<html>
<head>
<title>Mustang GT | Official Website</title>
<link rel="stylesheet" type="text/css" href="Prac 5.2.css">
</head>
<body>
<div class="header">
<div class="header-logo">Mustang GT</div>
</div>
<div class="navbar">
<a href="#">Home</a>
<a href="#">Features</a>
<a href="#">Design</a>
<a href="#">Safety</a>
<a href="#">Contact</a>
</div>
<div class="cover-image">
<h1>Mustang GT</h1>
<p>The ultimate driving machine, with a powerful 5.0L V8 engine and 460
horsepower.</p>
</div>
<div class="box margin">
<h2>Performance</h2>
<p>The Mustang GT is equipped with a 6-speed manual transmission, rear-
wheel drive, and a sport-tuned suspension.</p>
<p>It can go from 0-60mph in just 4.3 seconds, making it a thrill to drive.</p>
</div>
<div class="box margin">
<h2>Design</h2>
<p>The Mustang GT has a sleek and aggressive design, with a bold front grille,
LED headlights, and a sloping roofline.</p>
<p>The interior features premium materials, including leather-trimmed seats
and a heated steering wheel.</p>
</div>
<div class="box margin">
<h2>Safety Features</h2>
<p>The Mustang GT comes with a range of safety features, including:</p>
<ul>
<li>Forward collision warning</li>
<li>Automatic emergency braking</li>
<li>Blind spot monitoring</li>
<li>Lane departure warning</li>
40
Enrolment No.: 220840116069
</ul>
</div>
<div class="footer">
<p>© 2023 Mustang GT</p>
<a href="#">Terms of Service</a>
<a href="#">Privacy Policy</a>
</div>
</body>
</html>
.header {
background-color: #333;
color: #fff;
padding: 20px;
text-align: center;
display: flex;
justify-content: space-between;
align-items: center;
}
.header-logo {
font-size: 24px;
font-weight: bold;
margin-right: 20px;
}
.header-nav a {
color: #fff;
text-decoration: none;
margin: 0 20px;
}
.header-nav a:hover {
color: #ccc;
}
.navbar {
background-color: #444;
41
Enrolment No.: 220840116069
padding: 10px;
text-align: center;
display: flex;
justify-content: space-between;
align-items: center;
}
.navbar a {
color: #fff;
text-decoration: none;
margin: 0 20px;
}
.navbar a:hover {
color: #ccc;
}
.cover-image {
background-image: url('https://images.hdqwalls.com/wallpapers/vossen-gulf-ford-
mustang-mach-e-15-ne.jpg');
background-size: cover;
background-position: center;
height: 100vh;
width: 100vw;
display: flex;
justify-content: center;
align-items: center;
color: #fff;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}
.cover-image h1 {
font-size: 64px;
font-weight: bold;
margin-bottom: 20px;
text-align: center;
}
.cover-image p {
font-size: 24px;
margin-bottom: 40px;
text-align: center;
padding-top: 50px;
}
.box {
42
Enrolment No.: 220840116069
background-color: #fff;
padding: 20px;
border: 1px solid #ddd;
margin: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
border-radius: 10px;
}
.box h2 {
font-size: 24px;
font-weight: bold;
margin-bottom: 10px;
color: #333;
}
.box p {
font-size: 18px;
margin-bottom: 20px;
color: #666;
}
.margin {
margin: 20px;
}
.button {
background-color: #337ab7;
color: #fff;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
}
.button:hover {
background-color: #23527c;
}
.footer {
background-color: #333;
color: #fff;
padding: 20px;
text-align: center;
clear: both;
display: flex;
justify-content: space-between;
43
Enrolment No.: 220840116069
align-items: center;
}
.footer-logo {
font-size: 24px;
font-weight: bold;
margin-right: 20px;
}
.footer-nav {
display: flex;
justify-content: space-between;
align-items: center;
}
.footer-nav a {
color: #fff;
text-decoration: none;
margin: 0 20px;
}
.footer-nav a:hover {
color: #ccc;
}
44
Enrolment No.: 220840116069
OUTPUT
45
Enrolment No.: 220840116069
5.3 Inline Style Sheet (It should include cover image, color, text, font,
border, box, and margin).
Code: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Prac 5.3</title>
</head>
<body style="margin: 0; font-family: Arial, sans-serif; background-color: cyan;">
</body>
</html>
46
Enrolment No.: 220840116069
OUTPUT
47
Enrolment No.: 220840116069
PRACTICAL – 6
AIM: Develop applications using JavaScript.
6.1: Make an application which check user name and password with java
script. And user name and password are correct then navigate next
page.
.login-container {
width: 300px;
margin: 100px auto;
padding: 20px;
background-color: white;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
text-align: center;
}
48
Enrolment No.: 220840116069
label, input {
display: block;
width: 100%;
margin: 10px 0;
}
button {
padding: 10px;
width: 100%;
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
.error {
color: red;
}
JavaScript: File name: Prac 6.1.js
document.getElementById('loginForm').addEventListener('submit',
function(event) {
event.preventDefault();
// Dummy credentials
const validUsername = 'user';
const validPassword = 'password';
49
Enrolment No.: 220840116069
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome</title>
</head>
<body bgcolor="cyan">
<h1>Welcome!</h1>
<p>You have successfully logged in.</p>
</body>
</html>
OUTPUT
50
Enrolment No.: 220840116069
.container {
width: 300px;
margin: 100px auto;
padding: 20px;
background-color: white;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
text-align: center;
}
label, input {
display: block;
width: 100%;
margin: 10px 0;
51
Enrolment No.: 220840116069
button {
padding: 10px;
width: 100%;
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
.error {
color: red;
}
.success {
color: green;
}
JavaScript: File name: Prac 6.2.js
document.getElementById('validationForm').addEventListener('submit',
function(event) {
event.preventDefault();
52
Enrolment No.: 220840116069
if (isValid) {
document.getElementById('error').innerHTML = "";
document.getElementById('success').innerHTML = "Validation
successful!";
} else {
document.getElementById('error').innerHTML = errorMessage;
document.getElementById('success').innerHTML = "";
}
});
OUTPUT
53
Enrolment No.: 220840116069
6.3 Write a JavaScript that uses function to calculate how many days are
left in your birthday?
HTML code: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Days Until Birthday</title>
<link rel="stylesheet" href="Prac 6.3.css">
</head>
<body>
<div class="container">
<h2>Days Until Your Birthday</h2>
<label for="birthday">Enter your birthday (MM-DD):</label>
<input type="text" id="birthday" placeholder="MM-DD">
<button onclick="calculateDays()">Calculate</button>
<p id="result"></p>
</div>
<script src="Prac 6.3.js"></script>
</body>
</html>
CSS code: File name: Prac 6.3.css
body {
font-family: Arial, sans-serif;
background-color: Cyan;
}
.container {
width: 300px;
margin: 100px auto;
padding: 20px;
background-color: white;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
text-align: center;
}
label, input {
display: block;
width: 100%;
margin: 10px 0;
}
button {
padding: 10px;
width: 100%;
54
Enrolment No.: 220840116069
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
#error {
color: red;
}
#result {
color: green;
}
JavaScript: File name: Prac 6.3.js
function calculateDays() {
const birthdayInput = document.getElementById('birthday').value;
const today = new Date();
const currentYear = today.getFullYear();
const birthday = new Date(currentYear + '-' + birthdayInput);
55
Enrolment No.: 220840116069
OUTPUT
56
Enrolment No.: 220840116069
6.4 Write a JavaScript that uses a loop, which searches a word in sentence
held in an array, returning the index of the word.
HTML code: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Word Search in Sentence</title>
<link rel="stylesheet" href="Prac 6.4.css">
</head>
<body>
<div class="container">
<h2>Search for a Word in a Sentence</h2>
<label for="sentence">Enter a sentence:</label>
<input type="text" id="sentence">
<label for="word">Enter the word to search:</label>
<input type="text" id="word">
<button onclick="searchWord()">Search</button>
<p id="result"></p>
</div>
<script src="Prac 6.4.js"></script>
</body>
</html>
CSS code: File name: Prac 6.4.css
body {
font-family: Arial, sans-serif;
background-color: cyan;
}
.container {
width: 300px;
margin: 100px auto;
padding: 20px;
background-color: white;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
text-align: center;
}
label, input {
display: block;
width: 100%;
margin: 10px 0;
}
button {
57
Enrolment No.: 220840116069
padding: 10px;
width: 100%;
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
#error {
color: red;
}
#result {
color: green;
}
JavaScript: File name: Prac 6.4.js
function searchWord() {
const sentence = document.getElementById('sentence').value;
const word = document.getElementById('word').value;
const wordsArray = sentence.split(' '); // Split sentence into words
let index = -1;
58
Enrolment No.: 220840116069
OUTPUT
59
Enrolment No.: 220840116069
6.5 Write an HTML file with JavaScript that finds position of first
occurrence of vowel “a”, last occurrence of a vowel “a” in a given word
and returns the string between them. For example, ajanta- then script
would return first occurrence of “a”-that is position 1 and last
occurrence-6 and string between them is “jant”.
HTML code: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Find Vowel Positions</title>
<link rel="stylesheet" href="Prac 6.5.css">
</head>
<body>
<div class="container">
<h2>Find Vowel Positions and Substring</h2>
<label for="word">Enter a word:</label>
<input type="text" id="word" placeholder="Enter a word">
<button onclick="findSubstring()">Find</button>
<p id="result"></p>
</div>
<script src="Prac 6.5.js"></script>
</body>
</html>
CSS code: File name: Prac 6.5.css
body {
font-family: Arial, sans-serif;
background-color: cyan;
}
.container {
width: 300px;
margin: 100px auto;
padding: 20px;
background-color: white;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
text-align: center;
}
label, input {
display: block;
width: 100%;
margin: 10px 0;
}
60
Enrolment No.: 220840116069
button {
padding: 10px;
width: 100%;
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
#error {
color: red;
}
#result {
color: green;
}
JavaScript: File name: Prac 6.5.js
function findSubstring() {
const word = document.getElementById('word').value;
const firstIndex = word.indexOf('a');
const lastIndex = word.lastIndexOf('a');
61
Enrolment No.: 220840116069
OUTPUT
62
Enrolment No.: 220840116069
.container {
width: 300px;
margin: 100px auto;
padding: 20px;
background-color: white;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
text-align: center;
}
label, input {
display: block;
width: 100%;
margin: 10px 0;
}
button {
padding: 10px;
width: 100%;
background-color: #007bff;
63
Enrolment No.: 220840116069
color: white;
border: none;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
ul {
list-style-type: none;
padding: 0;
}
li {
background-color: #e0e0e0;
margin: 5px 0;
padding: 10px;
border-radius: 5px;
}
JavaScript: File name: Prac 6.6.js
function generateFibonacci() {
const N = document.getElementById('number').value;
const fibonacciList = document.getElementById('fibonacciList');
let a = 0, b = 1, next;
next = a + b;
a = b;
b = next;
}
}
64
Enrolment No.: 220840116069
OUTPUT
65
Enrolment No.: 220840116069
6.7 Write a JavaScript that handles following mouse events Add necessary
elements.
(i) JavaScript gives the key code for the key pressed.
(ii) If the key pressed is “a”, “e”, “i”, “o”, “u” the script should
announce that vowel is pressed.
(iii) When the key is released background should change to blue.
HTML code: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mouse and Keyboard Events</title>
<link rel="stylesheet" href="Prac 6.7.css">
</head>
<body>
<div class="container">
<h2>Mouse and Keyboard Events</h2>
<p>Click inside the input box and press any key:</p>
<input type="text" id="inputField" onkeydown="checkKey(event)"
onkeyup="changeBackground(event)">
<p id="keyCode"></p>
<p id="vowelMessage"></p>
</div>
<script src="Prac 6.7.js"></script>
</body>
</html>
CSS code: File name: Prac 6.7.css
body {
font-family: Arial, sans-serif;
background-color: cyan;
}
.container {
width: 300px;
margin: 100px auto;
padding: 20px;
background-color: white;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
text-align: center;
}
label, input {
display: block;
width: 100%;
66
Enrolment No.: 220840116069
margin: 10px 0;
}
button {
padding: 10px;
width: 100%;
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
#error {
color: red;
}
#result {
color: green;
}
JavaScript: File name: Prac 6.7.js
function checkKey(event) {
const keyCode = event.keyCode || event.which;
const keyChar = String.fromCharCode(keyCode).toLowerCase();
function changeBackground(event) {
document.body.style.backgroundColor = 'blue';
}
67
Enrolment No.: 220840116069
OUTPUT
68
Enrolment No.: 220840116069
.container {
width: 300px;
margin: 100px auto;
padding: 20px;
background-color: white;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
text-align: center;
}
label, input {
display: block;
width: 100%;
margin: 10px 0;
}
button {
padding: 10px;
width: 100%;
69
Enrolment No.: 220840116069
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
#error {
color: red;
}
#result {
color: green;
}
JavaScript: File name: Prac 6.8.js
function printOddCharacters() {
const inputString = document.getElementById('inputString').value;
let result = '';
70
Enrolment No.: 220840116069
OUTPUT
71
Enrolment No.: 220840116069
6.9 Write a JavaScript to take 2-digit number and then separate these 2
digits, then multiply first digit by itself for second digit times. (for
example, 23 should be separated as 2 and 3. 2 should multiply with itself
3 times)
HTML code: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Digit Separator and Multiplier</title>
<link rel="stylesheet" href="Prac 6.9.css">
</head>
<body>
<div class="container">
<h2>Digit Separator and Multiplier</h2>
<label for="number">Enter a 2-digit number:</label>
<input type="number" id="number" min="10" max="99" required>
<button onclick="separateAndMultiply()">Calculate</button>
<p id="result"></p>
</div>
<script src="Prac 6.9.js"></script>
</body>
</html>
CSS code: File name: Prac 6.9.css
body {
font-family: Arial, sans-serif;
background-color: cyan;
}
.container {
width: 300px;
margin: 100px auto;
padding: 20px;
background-color: white;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
text-align: center;
}
label, input {
display: block;
width: 100%;
margin: 10px 0;
}
button {
72
Enrolment No.: 220840116069
padding: 10px;
width: 100%;
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
#error {
color: red;
}
#result {
color: green;
}
JavaScript: File name: Prac 6.9.js
function separateAndMultiply() {
const number = document.getElementById('number').value;
const firstDigit = Math.floor(number / 10);
const secondDigit = number % 10;
let result = 1;
73
Enrolment No.: 220840116069
OUTPUT
74
Enrolment No.: 220840116069
.container {
width: 300px;
margin: 100px auto;
padding: 20px;
background-color: white;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
text-align: center;
}
button {
padding: 10px;
width: 80px;
75
Enrolment No.: 220840116069
margin: 5px;
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
#error {
color: red;
}
#result {
color: green;
}
#heading {
color: black;
transition: color 0.3s;
}
JavaScript: File name: Prac 6.10.js
document.getElementById('heading').addEventListener('mouseover',
function() {
this.style.color = 'yellow';
});
document.getElementById('heading').addEventListener('mouseout', function()
{
this.style.color = 'black';
});
function showDateTime() {
const now = new Date();
const dateTimeString = now.toString();
document.getElementById('dateTime').textContent = dateTimeString;
}
function changeBackground(color) {
document.body.style.backgroundColor = color;
}
76
Enrolment No.: 220840116069
OUTPUT
77
Enrolment No.: 220840116069
6.11 Write a program that convert a string written in JSON format, into a
JavaScript object.
HTML code: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JSON to JavaScript Object</title>
<link rel="stylesheet" href="Prac 6.11.css">
</head>
<body>
<div class="container">
<h2>Convert JSON String to JavaScript Object</h2>
<label for="jsonString">Enter JSON string:</label>
<textarea id="jsonString" rows="4" cols="50"></textarea>
<button onclick="convertToJson()">Convert</button>
<pre id="result"></pre>
</div>
<script src="Prac 6.11.js"></script>
</body>
</html>
CSS code: File name: Prac 6.11.css
body {
font-family: Arial, sans-serif;
background-color: cyan;
}
.container {
width: 300px;
margin: 100px auto;
padding: 20px;
background-color: white;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
text-align: center;
}
label, textarea {
display: block;
width: 100%;
margin: 10px 0;
}
button {
padding: 10px;
width: 100%;
78
Enrolment No.: 220840116069
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
pre {
background-color: #e0e0e0;
padding: 10px;
border-radius: 5px;
text-align: left;
}
JavaScript: File name: Prac 6.11.js
function convertToJson() {
const jsonString = document.getElementById('jsonString').value;
let jsonObject;
try {
jsonObject = JSON.parse(jsonString);
document.getElementById('result').textContent =
JSON.stringify(jsonObject, null, 2);
} catch (error) {
document.getElementById('result').textContent = `Invalid JSON string.
Error: ${error.message}`;
}
}
79
Enrolment No.: 220840116069
OUTPUT
80
Enrolment No.: 220840116069
PRACTICAL – 7
AIM: Write programs using PHP.
7.1 Write a PHP program to find whether entered year is leap year or not.
Code: <!DOCTYPE html>
<html>
<head>
<title>Leap Year Checker</title>
</head>
<body bgcolor="cyan">
<h2>Leap Year Checker</h2>
<form method="post">
Enter a year: <input type="number" name="year" required>
<input type="submit" value="Check">
</form>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$year = $_POST['year'];
81
Enrolment No.: 220840116069
OUTPUT
82
Enrolment No.: 220840116069
83
Enrolment No.: 220840116069
OUTPUT
84
Enrolment No.: 220840116069
7.3 Write a PHP program to read a text file and store it in array and
display the content of array.
Code: <!DOCTYPE html>
<html>
<head>
<title>Read File and Store in Array</title>
</head>
<body bgcolor="cyan">
<h2>Content of Text File</h2>
<?php
// Specify the file path
$filePath = 'sample-2.txt';
85
Enrolment No.: 220840116069
OUTPUT
86
Enrolment No.: 220840116069
7.4 Write PHP to store information of employee (employee id, job title, and
years of experience) in an array and output the data to a web page by
arranging the employees in ascending order of experience.
Code: <!DOCTYPE html>
<html>
<head>
<title>Employee Information</title>
<style>
table {
width: 50%;
margin: 50px auto;
border-collapse: collapse;
}
th, td {
border: 1px solid black;
padding: 8px;
text-align: center;
}
th {
background-color: #f2f2f2;
}
</style>
</head>
<body bgcolor="cyan">
<h2 style="text-align: center;">Employee Information</h2>
<table>
<tr>
<th>Employee ID</th>
<th>Job Title</th>
<th>Years of Experience</th>
</tr>
<?php
// Employee data stored in an array
$employees = [
["id" => 101, "title" => "Software Developer", "experience" => 3],
["id" => 102, "title" => "Project Manager", "experience" => 5],
["id" => 103, "title" => "System Analyst", "experience" => 2],
["id" => 104, "title" => "Tester", "experience" => 4],
["id" => 105, "title" => "Database Administrator", "experience" => 6],
];
87
Enrolment No.: 220840116069
OUTPUT
88
Enrolment No.: 220840116069
$username = $_POST['username'];
$password = $_POST['password'];
if (!isset($_SESSION['username'])) {
header('Location: login.php');
89
Enrolment No.: 220840116069
exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Welcome</title>
</head>
<body>
<h2>Welcome, <?php echo $_SESSION['username']; ?>!</h2>
<p>You have successfully logged in.</p>
<a href="logout.php">Logout</a>
</body>
</html>
Logout page: File name: logout.php
<?php
session_start();
session_unset();
session_destroy();
setcookie('username', '', time() - 3600, "/"); // delete the cookie
header('Location: login.php');
?>
90
Enrolment No.: 220840116069
OUTPUT
91
Enrolment No.: 220840116069
PRACTICAL – 8
AIM: Develop applications using PHP and MYSQL.
8.1: Make an application using PHP that collects student information like
name, PEN, Gender (use Radio Button), Branch (use Drop Down
Box), Semester, contact number (Text Box should masked with
numbers only) and address. Create buttons for Insert, Delete, Update
and Retrieve the details in/from the database. Alter the table to add a
column and add data in that new column.
Code: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Student Information</title>
</head>
<body>
<h2>Student Information Form</h2>
<form action="index.php" method="POST">
<label for="name">Name:</label>
<input type="text" name="name" required><br><br>
<label for="pen">PEN:</label>
<input type="text" name="pen" required><br><br>
<label>Gender:</label>
<input type="radio" name="gender" value="Male" required> Male
<input type="radio" name="gender" value="Female" required> Female
<input type="radio" name="gender" value="Other" required> Other<br><br>
<label for="branch">Branch:</label>
<select name="branch" required>
<option value="Information Technology">Information Technology</option>
<option value="Computer Science">Computer Science</option>
<option value="Mechanical">Mechanical</option>
<option value="Civil">Civil</option>
<option value="Electronics">Electronics</option>
</select><br><br>
<label for="semester">Semester:</label>
<input type="number" name="semester" required><br><br>
<label for="contact">Contact Number:</label>
<input type="text" name="contact" pattern="\d*" maxlength="10"
required><br><br>
<label for="address">Address:</label>
<textarea name="address" required></textarea><br><br>
<label for="email">Email:</label>
<input type="email" name="email"><br><br>
92
Enrolment No.: 220840116069
93
Enrolment No.: 220840116069
$gender = $_POST['gender'];
$branch = $_POST['branch'];
$semester = $_POST['semester'];
$contact = $_POST['contact']; $semester = $_POST['semester'];
$contact = $_POST['contact'];
$address = $_POST['address'];
$email = $_POST['email']; // Correct email variable
$sql = "INSERT INTO students (name, pen, gender, branch, semester,
contact_number, address, email)
VALUES ('$name', '$pen', '$gender', '$branch', '$semester', '$contact',
'$address', '$email')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
}
if (isset($_POST['delete'])) {
$id = $_POST['id'];
$sql = "DELETE FROM students WHERE id = $id";
if ($conn->query($sql) === TRUE) {
echo "Record deleted successfully";
} else {
echo "Error deleting record: " . $conn->error;
}
}
if (isset($_POST['update'])) {
$id = $_POST['id'];
$name = $_POST['name'];
$pen = $_POST['pen'];
$gender = $_POST['gender'];
$branch = $_POST['branch'];
$semester = $_POST['semester'];
$contact = $_POST['contact'];
$address = $_POST['address'];
$email = $_POST['email']; // Correct email variable
$sql = "UPDATE students
SET name='$name', pen='$pen', gender='$gender', branch='$branch',
email='$email', semester='$semester', contact_number='$contact',
address='$address' WHERE id=$id";
if ($conn->query($sql) === TRUE) {
echo "Record updated successfully";
} else {
echo "Error updating record: " . $conn->error;
}
}
94
Enrolment No.: 220840116069
95
Enrolment No.: 220840116069
OUTPUT
96
Enrolment No.: 220840116069
97
Enrolment No.: 220840116069
8.2: Customize your own WebPages/web application. You may use HTML,
Frame Navigation, CSS, JavaScript’s, PHP, Cookies, Session,
MYSQL Database Manipulation (Insert, Delete, Update and
Retrieve), URL Redirecting, File Uploads, and WEB SERVICES.
Code: File name: index.php
<?php
include 'db/db.php';
include 'session.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$name = $_POST['name'];
$query = "INSERT INTO users (name) VALUES ('$name')";
$conn->query($query);
}
$result = $conn->query("SELECT * FROM users");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PHP Session, CRUD, File Upload</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<!-- Navigation Bar -->
<nav>
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="index.php">Insert User</a></li>
<li><a href="index.php">Update User</a></li>
<li><a href="index.php">Delete User</a></li>
<li><a href="index.php">Retrieve Users</a></li>
</ul>
</nav>
<div class="container">
<h1>Welcome, <?php echo $_SESSION['username']; ?>!</h1>
<!-- Form to Insert User -->
<h2>Insert User</h2>
<form action="index.php" method="POST">
<input type="text" name="name" placeholder="Enter name" required>
<button type="submit">Insert</button>
</form>
<!-- Display Users List -->
<h2>Users List</h2>
<ul>
98
Enrolment No.: 220840116069
99
Enrolment No.: 220840116069
}
nav ul li a {
color: #fff;
text-decoration: none;
font-size: 18px;
padding: 8px 16px;
transition: background 0.3s ease;
}
nav ul li a:hover {
background-color: #555;
border-radius: 4px;
}
.container {
max-width: 1200px;
margin: 40px auto;
padding: 20px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
h1, h2 {
text-align: center;
margin-bottom: 20px;
font-weight: 400;
color: #333;
}
form {
display: flex;
flex-direction: column;
align-items: center;
}
form input[type="text"],
form input[type="file"] {
width: 50%;
padding: 10px;
margin-bottom: 20px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 16px;
}
form button {
padding: 10px 20px;
background-color: #28a745;
color: white;
border: none;
cursor: pointer;
100
Enrolment No.: 220840116069
border-radius: 4px;
transition: background 0.3s ease;
}
form button:hover {
background-color: #218838;
}
ul {
list-style: none;
margin: 0;
padding: 0;
}
ul li {
background-color: #eee;
padding: 10px;
margin: 10px 0;
border-radius: 4px;
display: flex;
justify-content: space-between;
align-items: center;
}
ul li a {
padding: 5px 10px;
background-color: #007bff;
color: white;
text-decoration: none;
border-radius: 4px;
margin-left: 10px;
transition: background 0.3s ease;
}
ul li a:hover {
background-color: #0056b3;
}
footer {
text-align: center;
margin-top: 40px;
padding: 10px;
background-color: #333;
color: white;
position: relative;
bottom: 0;
width: 100%;
}
File name: db.php
<?php
$host = "localhost";
$user = "root";
101
Enrolment No.: 220840116069
$pass = "Your_password";
$dbname = "mydatabase";
$conn = new mysqli($host, $user, $pass, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>
File name: session.php
<?php
session_start();
if (!isset($_SESSION['username'])) {
$_SESSION['username'] = 'guest';
}
setcookie("user", $_SESSION['username'], time() + 3600); // 1-hour expiration
?>
File name: delete.php
<?php
include 'db/db.php';
if (isset($_GET['id'])) {
$id = $_GET['id'];
$query = "DELETE FROM users WHERE id = $id";
$conn->query($query);
header("Location: index.php");
}
?>
File name: update.php
<?php
include 'db/db.php';
include 'session.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$id = $_POST['id'];
$name = $_POST['name'];
$query = "UPDATE users SET name='$name' WHERE id='$id'";
$conn->query($query);
header("Location: index.php");
exit();
}
if (isset($_GET['id'])) {
$id = $_GET['id'];
$result = $conn->query("SELECT * FROM users WHERE id='$id'");
$user = $result->fetch_assoc();
} else {
echo "No user ID specified.";
exit();
}
102
Enrolment No.: 220840116069
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Update User</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<h1>Update User</h1>
<form action="update.php" method="POST">
<input type="hidden" name="id" value="<?php echo $user['id']; ?>">
<input type="text" name="name" value="<?php echo $user['name']; ?>"
required>
<button type="submit">Update</button>
</form>
</body>
</html>
File name: upload.php
<?php
// upload.php
if (isset($_FILES['file'])) {
$file_name = $_FILES['file']['name'];
$file_tmp = $_FILES['file']['tmp_name'];
103
Enrolment No.: 220840116069
OUTPUT
104
Enrolment No.: 220840116069
PRACTICAL – 9
AIM: Write a program of hello world using jQuery and Ajax.
HTML Code: File name: index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hello World with jQuery and Ajax</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<style>
#result {
margin-top: 20px;
font-size: 24px;
font-weight: bold;
}
</style>
</head>
<body>
<h1>Hello World using jQuery and Ajax</h1>
<button id="helloButton">Get Hello World</button>
<div id="result"></div>
<script>
$(document).ready(function() {
$("#helloButton").click(function() {
$.ajax({
url: "hello.php", // URL of the PHP script
method: "GET",
success: function(data) {
$("#result").html(data); // Display the result
},
error: function() {
$("#result").html("Error occurred while fetching data.");
}
});
});
});
</script>
</body>
</html>
File name: hello.php
<?php
echo "Hello, World!";
?>
105
Enrolment No.: 220840116069
OUTPUT
106