Web Program Lab Record
Web Program Lab Record
Name : ...............................................................
Class:………MCA……Semester:……S1…….
Year:………2025-2027……………………….
……….……............................……………
Place: Kuttichal
Date: …...........
1
[Link] NAME OF THE EXPERIMENT DATE PAGE NO.
2
INTRODUCTION
HTML stands for Hyper Text Markup Language. It is a formatting language
used to define the appearance and contents of a web page. It allows us to
organize text, graphics, audio, and video on a web page.
Key Points:
The word Hypertext refers to the text which acts as a link.
The word markup refers to the symbols that are used to define structure of
the text. The markup symbols tells the browser how to display the text and
are often called tags.
The word Language refers to the syntax that is similar to any other language.
VERSION YEAR
XHTML 2000
HTML5 2012
3
HTML Tags
Tag is a command that tells the web browser how to display the text, audio,
graphics or video on a web page.
Key Points:
Tags are indicated with pair of angle brackets.
They start with a less than (<) character and end with a greater than (>)
character.
The tag name is specified between the angle brackets.
Most of the tags usually occur in pair: the start tag and the closing tag.
The start tag is simply the tag name is enclosed in angle bracket whereas the
closing tag is specified including a forward slash (/).
Some tags are the empty i.e. they don’t have the closing tag.
Tags are not case sensitive.
The starting and closing tag name must be the same. For example <b> hello
</i> is invalid as both are different.
If you don’t specify the angle brackets (<>) for a tag, the browser will treat
the tag name as a simple text.
The tag can also have attributes to provide additional information about the
tag to the browser.
Features of HTML:
HTML is the most common used language to write web pages. It has
recently gained popularity due to its advantages such as: -
It is the language which can be easily understood and can be modified.
Effective presentations can be made with the HTML with the help of its all
formatting tags.
It provides the more flexible way to deign web pages along with the text.
Links can also be added to the web pages so it helps the readers to browse
the information of their interest.
You can display HTML documents on any platforms such as Macintosh,
Windows and Linux etc.
Graphics, videos and sounds can also be added to the web pages which give
an extra attractive look to your web pages.
4
Top 5 Uses of HTML
HTML is heavily used for creating pages that are displayed on the world
wide web. Every page contains a set of HTML tags, including hyperlinks
which are used for connecting to other pages. Every page that we witness
on the world wide web is written using a version of HTML code.
Internet navigation
5
HTML5, with its set of standards and API, is being used to introduce some
of the latest trends in the website creation business. Like polyfill libraries,
which are supported by old browsers equally well. Browser like Google
Chrome is the perfect choice when it comes to implementing an HTML5
latest set of standards and APIs. A JavaScript library is available called
Modernizr, which can detect features that let the developer dynamically load
polyfill libraries as required.
PHP
PHP was created by Rasmus Lerdorf in 1994 but appeared in the market in
1995. PHP 7.4.0 is the latest version of PHP, which was released on 28
November.
6
• PHP stands for Hypertext Preprocessor.
• PHP is an interpreted language, i.e., there is no need for
compilation.
• PHP is faster than other scripting languages, for example, ASP
and JSP.
• PHP is a server-side scripting language, which is used to
manage the dynamic content of the website.
• PHP can be embedded into HTML.
• PHP is an object-oriented language.
• PHP is an open-source scripting language.
• PHP is simple and easy to learn language.
PHP is a server-side scripting language, which is used to design the
dynamic web applications with MySQL database.
• It handles dynamic content, database as well as session tracking
for the website.
• You can create sessions in PHP.
• It can access cookies variable and also set cookies.
• It helps to encrypt the data and apply validation.
• PHP supports several protocols such as HTTP, POP3, SNMP,
LDAP, IMAP, and many more.
• Using PHP language, you can control the user to access some
pages of your website.
• As PHP is easy to install and set up, this is the main reason
why PHP is the best language to learn.
• PHP can handle the forms, such as - collect the data from users
using forms, save it into the database, and return useful
information to the user.
• For example - Registration form.
PHP Features
7
PHP is very popular language because of its simplicity and open source.
There are some important features of PHP given below:
Performance:
PHP script is executed much faster than those scripts which are written
in other languages such as JSP and ASP. PHP uses its own memory, so
the server workload and loading time is automatically reduced, which
results in faster processing speed and better performance.
Open source :
PHP source code and software are freely available on the web. You can
develop all the versions of PHP according to your requirement without
paying any cost. All its components are free to download and use.
Embedded:
PHP code can be easily embedded within HTML tags and script.
Platform Independent:
Database Support:
8
PHP supports all the leading databases such as MySQL, SQLite, ODBC,
etc.
Error reporting:
PHP is compatible with almost all local servers used today like Apache,
Netscape, Microsoft IIS, etc.
Security:
Control:
9
It has a large community of developers who regularly updates
documentation, tutorials, online help, and FAQs. Learning PHP from
the communities is one of the significant benefits.
Applications of PHP
1. Webpages and Web-based applications:
Any web page or web application developed in the current
ecosystem needs to offer a high degree of customization, provide a
highly interactive user interface, be capable of performing online
transactions and integrate with database systems. Through its three-
tiered architecture which works on browser, server, and database
systems in a linear manner, PHP offers a reliable solution to achieve
these features. As a consequence, PHP is used by over 82% of websites
for server-side programming; over 244 million website sare built using
PHP.
3. eCommerce Applications:
10
From small businesses to large enterprises, selling to online shoppers
is now an indispensable requirement. Through the use of frameworks
like CodeIgniter and CakePHP, PHP allows the creation of eCommerce
applications in a swift and simple manner. Many of the highly used
eCommerce platforms, such as OpenCart, Magento, PrestaShop, Zen
Cart, AgoraCart, and Ubercart, have all been created on PHP.
4. GUI-Based Applications:
While PHP is largely used as a scripting language for web-based
applications, it is also possible to employ it for creating desktop
graphical user interface (GUI) based applications. Tools like PHP-GTK
2, DevelStudio, and ZZEE PHP GUI, allow scripting in PHP, compiling
it into .exe capable of running standalone.
5. Create Flash:
An open-source library, such as Ming, helps to create .SWF format
movies which include most of the features of Flash – gradients,
bitmaps (pngs and jpeg), morphs, shapes, text, button, actions, and
animations. Further, Flash elements like login-form and email form
can be easily created and incorporated into dynamic web pages using
PHP.
11
PROGRAM NO:1 DATE:02/09/2025
AIM: CREATE A HTML FILE TO LINK A DIFFERENT HTML PAGE
WHICH CONTAINS IMAGES , TABLES AND ALSO LINK WITHIN A
PAGE.
SOURCE CODE:
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Image page</title>
</head>
<body style="background-color: rgb(255, 255, 255);">
<center>
<br><br>
<img src="[Link]" style="width: 900px; height : 500px"><br><br>
<a href="[Link]"alt="page2"><input type="button" value="Click here"></a>
</center>
</body>
</html>
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>table page</title>
</head>
<body>
<center>
<h2>----Iphone Price Table--- </h2>
12
<table style="width: 600px;" bgcolor="black">
<tr bgcolor="grey">
<th widht="200px">NAME</th>
<th widht="200px">SPECS</th>
<th widht="200px">PRICE</th>
</tr>
<tr bgcolor="lightgrey" align="center">
<td>IPHONE 15</td>
<td>A16 Bionic</td>
<td>80,000Rs</td>
</tr>
<tr bgcolor="lightgrey" align="center">
<td>IPHONE 15 plus</td>
<td>A16 Bionic</td>
<td>90,000Rs</td>
</tr>
<tr bgcolor="lightgrey" align="center">
<td>IPHONE 15 pro</td>
<td>A17 pro</td>
<td>1,30,000Rs</td>
</tr>
<tr bgcolor="lightgrey" align="center">
<td>IPHONE 15 pro max</td>
<td>A17 pro</td>
<td>1,59,000Rs</td>
</tr>
</table><br>
<a href="[Link]
15-and-iphone-15-
plus/" target="new"><img src="[Link]" style="width: 300px;
height : 150px"></a>
</center>
13
</body>
</html>
OUTPUT
14
15
PROGRAM NO:2 DATE:08/09/2025
AIM : CREATE AN HTML FILE BY APPLYING THE DIFFERENT STYLES
USING IN LINE, EXTERNAL AND INTERNAL STYLE SHEET
SOURCE CODE:
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Styling Example</title>
<link rel="stylesheet" href="[Link]">
<style>
h1{color:blue;}
p{font-size:16px;}
</style>
</head>
<body>
<h1 style="font-family:Arial;">Heading with Inline Style</h1>
<p style="font-family:Arial;">Paragraph with Inline Style</p>
<div class="styled-div">
<p>This paragraph is styled using an external style sheet.</p>
</div>
</body>
</html>
External style sheet :
.styled-div{background-color:lightgray;padding:10px;border-radius:5px;}
.styled-div p{font-style:italic;}
16
OUTPUT
17
PROGRAM NO:3 DATE:15/09/2025
AIM : CREATE A REGISTRATION FORM USING HTML AND TO
VALIDATE IT USING JAVA SCRIPT.
SOURCE CODE:
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Register</title>
<link rel="stylesheet" href="[Link]">
</head>
<body class="blue-bg">
<center>
<form method="post" action="[Link]" class="box">
<h2>REGISTER</h2>
<input type="text" name="username" placeholder="Username" required><br>
<input type="email" name="email" placeholder="Email" required><br>
<input type="password" name="password" placeholder="Password" required><br>
<input type="text" name="phone_number" placeholder="Phone Number"
required><br>
<input type="submit" value="Register" class="btn">
<p>Already have an account?</p>
<a href="[Link]">
<button type="button" class="btn-alt">Login</button></a>
</form>
<img src="[Link]" width="100" alt="good luck">
</center>
</body>
</html>
18
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login</title>
<link rel="stylesheet" href="[Link]">
<script>
function validate(){
let n=[Link]();
let p=[Link]();
if(!n||!p){alert("Fields cannot be empty");return false;}
if([Link]<6){alert("Password must be at least 6 characters");return false;}
if(n!=="midhun"||p!=="midhun@7025"){alert("Invalid credentials");return false;}
}
</script>
</head>
<body class="purple-bg">
<center>
<marquee>The Result has been published. Please log in to view your
credentials.</marquee>
<form name="myform" onsubmit="return validate()" class="box"
action="[Link]">
<h2>STUDENT LOGIN</h2>
<input type="text" name="name" placeholder="Username" required><br>
<input type="password" name="password" placeholder="Password" required><br>
<input type="submit" value="Login" class="btn"><br><br>
<input type="button" value="Forgot Password" class="btn-alt">
</form>
<img src="[Link]" width="200" alt="minion">
</center>
</body>
19
</html>
[Link]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Student Marks</title>
</head>
<body style="font-family:Arial; background:#e6f0ff; text-align:center;">
<h2>Welcome, Midhun!</h2>
<p>Your marks will appear here.</p>
<a href="[Link]">
<button>Logout</button>
</a>
</body>
</html>
20
margin:50px auto;
padding:20px;
width:280px;
border-radius:10px;
box-shadow:0 0 10px rgba(0,0,0,0.5);}
input{
margin:6px;
padding:6px;
width:80%;
border:1px solid #ccc;
border-radius:5px;}
.btn,.btn-alt{
background:#D76F30;
color:white;
border:none;
border-radius:5px;
padding:6px 10px;
cursor:pointer;}
.btn:hover,.btn-alt:hover{
background:white;
color:#D76F30;
border:1px solid #D76F30;}
marquee{margin-top:10px;color:#fff;}
21
OUTPUT
22
23
PROGRAM NO:4 DATE:23/09/2025
AIM : GENERATE A CALENDER USING JAVASCRIPT CODE BY
GETTING YEAR FROM THE USER. SOURCE CODE:
SOURCE CODE:
[Link]
<!DOCTYPE html>
<html><head>
<style>
table,th,td{border:1px solid black;border-collapse:collapse;padding:5px;text-
align:center;}
</style>
</head>
<body>
Enter Year:
<input type="number" id="y">
<button onclick="cal()">Generate</button>
<div id="out"></div>
<script>
function cal(){
let y=[Link]("y").value;
let days=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];
let out="";
for(let m=0;m<12;m++){
out+="<h3>"+new Date(y,m).toLocaleString('en',{month:'long'})+"</h3>";
out+="<table><tr>";
for(let d of days)out+="<th>"+d+"</th>";
out+="</tr><tr>";
let f=new Date(y,m,1).getDay();
let t=new Date(y,m+1,0).getDate();
for(let i=0;i<f;i++)out+="<td></td>";
for(let d=1;d<=t;d++){
out+="<td>"+d+"</td>";
24
if((d+f)%7==0)out+="</tr><tr>";}
out+="</tr></table>";}
[Link]("out").innerHTML=out;}
</script>
</body>
</html>
OUTPUT
25
PROGRAM NO:5 DATE:30/09/2025
AIM : CREATE AN HTML PAGE TO SHOW AN ONLINE EXAM USING
JAVASCRIPT.
SOURCE CODE:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Quiz</title>
</head>
<body>
[Link] is 2+3?<br>
[Link] is 2+1?<br>
[Link] is 2+4?<br>
26
<input type="submit" value="submitQuiz" onclick="result()">
<script>
function result(){
let s=0;
if([Link])s++;
if([Link])s++;
if([Link])s++;
</script>
</body>
</html>
OUTPUT
27
PROGRAM NO:6 DATE:07/10/2025
AIM : COMPOSE ELECTRICITY BILL FROM USER INPUT BASED ON A
GIVEN TARIF ON PHP.
SOURCE CODE:
[Link]
<!DOCTYPE html>
<html>
<head>
<title>Electricity Bill Calculator</title>
<style>
body{font-family:Arial,sans-serif;margin:20px;background:aqua;}
h2{color:#333;}
label{font-weight:bold;}
#usage{padding:8px;width:200px;}
input[type="number"]{
padding:10px;color:black;border:1px solid transparent;
border-radius:4px;cursor:pointer;box-shadow:4px 5px 8px black;
}
input[type="submit"]{
padding:10px 20px;background:#4CAF50;color:white;
border:1px solid transparent;border-radius:4px;cursor:pointer;
}
input[type="submit"]:hover{
background:greenyellow;color:black;box-shadow:2px 5px 8px black;
}
</style>
</head>
<body>
<center>
<h2>Electricity Bill Calculator</h2>
<form action="[Link]" method="post" target="blank">
28
<label>Enter electricity usage in kWh:</label><br><br>
<input type="number" id="usage" name="usage" required><br><br>
<input type="submit" value="Calculate Bill">
</form>
</center>
</body>
</html>
[Link]
<!DOCTYPE html>
<html>
<head>
<title>Electricity Bill Result</title>
<style>
body{font-family:Arial,sans-serif;margin:20px;background:grey;}
h2{color:#333;}
.bill{
background:aqua;border:1px solid transparent;border-radius:5px;
width:30%;height:180px;box-shadow:10px 6px 10px black;
}
</style>
</head>
<body>
<center><br><br>
<div class="bill"><br>
<h2>Electricity Bill Result</h2>
<?php
if(isset($_POST['usage'])){
$u=$_POST['usage'];
$base=10;$r1=0.15;$r2=0.20;
$bill=($u<=100)?$base+($u*$r1):
$base+(100*$r1)+(($u-100)*$r2);
29
echo "<p>Electricity Usage: $u kWh</p>";
echo "<p>Bill Amount: $".number_format($bill,2)."</p>";
}else{
echo "<p>No usage data submitted.</p>";
} ?>
</div>
</center>
</body>
</html>
OUTPUT
30
PROGRAM NO:7 DATE:14/10/2025
AIM : PREPARE A PHP CODE TO STORE NAMES OF INDIAN CRICKET
PLAYER IN AN ARRAY AND DISPLAY THE TABLE
SOURCE CODE:
[Link]
<!DOCTYPE html>
<html>
<head>
<style>
table{border-collapse:collapse;width:50%;}
th{background:#f2f2f2;}
</style>
</head>
<body>
<center><br>
<?php
?>
<table>
<tr><th>Sn No.</th><th>Name</th></tr>
<?php
foreach($players as $i=>$p)
echo "<tr><td>".($i+1)."</td><td>$p</td></tr>";
?>
</table>
31
</center>
</body>
</html>
OUTPUT
32
PROGRAM NO:8 DATE:27/10/2025
AIM : USING PHP AND MYSQL DEVELOP A PROGRAM TO ACCEPT
BOOK INFO (edition number, title, authors, edition and publisher) FROM A
WEBPAGE AND STORE THE INFO IN A DATABASE AND TO SEARCH
FOR A BOOK WITH THE TITLE SPECIFIED BY THE USER AND TO
DISPLAY WITH PROPER HEADING.
SOURCE CODE:
[Link]
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Library Management</title>
<style>
*{font-family:system-ui;}
body{background:url('[Link]') no-repeat fixed;background-size:100% 100%;}
.box{width:30%;margin:auto;box-shadow:10px 7px 20px black;border-radius:15px;}
.head{background:aqua;border-radius:10px 10px 0 0;}
.form{background:#133e64;height:350px;border-radius:0 0 10px 10px;}
input{border:1px solid #4f4c4c;border-radius:4px;margin-bottom:8px;padding:4px;}
.btn{font-weight:bold;color:white;border:2px solid #333;padding:5px;cursor:pointer;}
.insert{background:#0b99d6;}
.insert:hover{background:green;}
.search{background:#c0354c;}
.search:hover{background:#45ad45;color:black;}
</style>
</head>
<body><br><br>
<center>
<div class="box">
<div class="head"><h2>BOOK INFO</h2></div>
<div class="form"><br>
33
<form action="[Link]" method="post" target="blank">
<label style="color:white"><b>EDITION</b></label><br>
<input type="text" name="edition"><br>
<label style="color:white"><b>TITLE</b></label><br>
<input type="text" name="title" required><br>
<label style="color:white"><b>AUTHOR</b></label><br>
<input type="text" name="author"><br>
<label style="color:white"><b>PUBLISHER</b></label><br>
<input type="text" name="publisher"><br>
<input type="submit" value="INSERT" class="btn insert" name="submit"><br><br>
<a href="[Link]" target="blank">
<input type="button" value="Search Book" class="btn search">
</a>
</form>
</div>
</div>
</center>
</body>
</html>
[Link]
<?php
$conn=mysqli_connect("localhost","root","","library");
if(!$conn)die("Connection Failed");
$e=$_POST['edition'];
$t=$_POST['title'];
$a=$_POST['author'];
$p=$_POST['publisher'];
[Link]
<!DOCTYPE html>
<html>
<head>
<title>Book Search</title>
<style>
body{background:url('[Link]') no-repeat fixed;background-size:100% 100%;}
.box{width:30%;margin:auto;background:#133e64;border-radius:10px;}
input{width:270px;padding:5px;}
.btn{background:#c0354c;color:white;border:2px solid #444;padding:6px;}
</style>
</head>
<body><br><center>
<div class="box"><br>
<h2 style="color:white">BOOK SEARCH</h2>
<form action="[Link]" method="post">
<input type="text" name="title" placeholder="Enter Title"><br><br>
<input type="submit" value="SEARCH" class="btn">
</form><br>
</div>
</center></body>
</html>
[Link]
<!DOCTYPE html>
<html>
<body style="font-family:system-ui;font-size:18px">
<center><br>
<?php
$conn=mysqli_connect("localhost","root","","library");
if(!$conn)die("Connection Failed");
35
$t=$_POST['title'];
$sql="SELECT * FROM book WHERE title LIKE '%$t%'";
$res=mysqli_query($conn,$sql);
if(mysqli_num_rows($res)>0){
while($r=mysqli_fetch_assoc($res)){
echo "<h3>".$r['title']."</h3>";
echo "Edition: ".$r['edition_number']."<br>";
echo "Author: ".$r['author']."<br>";
echo "Publisher: ".$r['publisher']."<br><br>";
}}
else echo "<h3>Data Not Found</h3>";
mysqli_close($conn);
?>
</center>
</body>
</html>
OUTPUT
36
37
PROGRAM NO:9 DATE:03/10/2025
AIM : EVALUVATE JAVA SCRIPT EVENT HANDLING FOR EVERY
CLICK OF A BUTTON.
SOURCE CODE:
[Link]
<!DOCTYPE html>
<html><head><title>Color</title></head>
<body><center>
<h2>COLOUR CHANGING WEBPAGE</h2>
<button onclick="c()">Click</button>
<script>
function c(){
[Link]=["black","blue","red","green"][[Link](Mat
[Link]()*4)]
}
</script>
</center>
</body>
</html>
OUTPUT
38
PROGRAM NO:10 DATE:18/10/2025
AIM: PHP PROGRAM FOR INSERTION , UPDATION , DELETION AND
RETRIEVING RECORDS.
SOURCE CODE:
[Link]
<!DOCTYPE html>
<html>
<head>
<title>PHP MySQL</title>
</head>
<body>
<?php
$con=mysqli_connect("localhost","root","","accounts");
if(!$con)die("Connection Failed");
$id=$name=$sal="";
$msg="Connected Successfully<br>";
if(isset($_POST['select'])){
$id=$_POST['id'];
$q=mysqli_query($con,"SELECT * FROM salary WHERE id='$id'");
if(mysqli_num_rows($q)){
$r=mysqli_fetch_assoc($q);
$id=$r['id'];$name=$r['name'];$sal=$r['salary'];
}else $msg="No Record Found";
}
if(isset($_POST['insert'])){
$id=$_POST['id'];$name=$_POST['name'];$sal=$_POST['sal'];
$msg=mysqli_query($con,"INSERT INTO salary VALUES('$id','$name','$sal')")
?"Insert Success":"Insert Failed";
}
if(isset($_POST['update'])){
$id=$_POST['id'];$name=$_POST['name'];$sal=$_POST['sal'];
39
$msg=mysqli_query($con,"UPDATE salary SET name='$name',salary='$sal' WHERE
id='$id'")
?"Update Success":"Update Failed";
}
if(isset($_POST['delete'])){
$id=$_POST['id'];
$msg=mysqli_query($con,"DELETE FROM salary WHERE id='$id'")
?"Delete Success":"Delete Failed";
}
?>
<h2>PHP MYSQL CRUD</h2>
<form method="post">
ID:<input type="number" name="id" value="<?php echo $id;?>"><br>
Name:<input type="text" name="name" value="<?php echo $name;?>"><br>
Salary:<input type="text" name="sal" value="<?php echo $sal;?>"><br><br>
<input type="submit" name="select" value="SELECT">
<input type="submit" name="insert" value="INSERT">
<input type="submit" name="update" value="UPDATE">
<input type="submit" name="delete" value="DELETE">
<input type="submit" name="selectall" value="SELECT ALL">
<input type="reset" value="RESET">
</form>
<?php
echo "<br>$msg<br>";
if(isset($_POST['selectall'])){
$q=mysqli_query($con,"SELECT * FROM salary");
while($r=mysqli_fetch_assoc($q))
echo "ID:{$r['id']} Name:{$r['name']} Salary:{$r['salary']}<br>";
}
mysqli_close($con);
?>
40
</body>
</html>
OUTPUT
41