HTML Programs: Web Programming
HTML Programs: Web Programming
HTML Programs: Web Programming
HTML PROGRAMS
PROGRAM NO: 1
program:
Create a co-operate web page.Divide the browser screen into two frames.Frame on left
will be a menu consisting of hyperlinks.Clicking on anyone of these hyperlinks will lead
to a new page which must open in the frame on right hand side.
Code:
frame.html
<html>
<frameset cols="50,50">
<frame src="college.html">
</frameset>
</html>
college.html
<html>
<head>
<title>SIST</title>
</head>
<body bgcolor="lightgreen">
<center>
<b>
<h2>Mangattuparamba</h2><br><br><br>
</b>
</center>
</body>
</html>
login.html
<html>
<head>
<title>SIST</title>
</head>
<body bgcolor="lightgreen">
<center>
<b>
<h1>Login</h1>
</b>
<form>
<table align="center">
<tr><th>Username</th><th><input type="text"></th></tr>
<tr><th>Password</th><th><input type="password"></th></tr>
</table>
</form>
</body>
</html>
dept.html
<html>
<head>
<title>SIST</title>
</head>
<body bgcolor="lightgreen">
<center>
<b><h2>Departments</h2>
<ul type="circle">
<tr><li>Department of Mathematics
<li>Department of Statistics
<li>Department of IT
<li>Department of History
</ul>
</b>
</body>
</html>
img.html
<html>
<head>
<title>SIST</title>
</head>
<body bgcolor="lightgreen">
<center>
<b>
<h1>Photos</h1>
</b>
<body>
</html>
course.html
<html>
<head>
<title>SIST</title>
</head>
<body bgcolor="lightgreen">
<center>
<b>
<h2>Mangattuparamba</h2><br><br><br>
</b>
</center>
</body>
</html>
OUTPUT:
PROGRAM NO:2
Program:
Create a table that contains marks of students, which use colspan and rowspan.
code:
<html>
<head>
<title>mark</title>
</head>
<body>
<center>
<h1><u>MARKLIST</u></h1>
<br><br><br><br><br><br>
<tr><th rowspan="3">Name</th></tr>
<tr><th colspan="3">Marks</th></tr>
<tr>
<th>SE</th>
<th>DBMS</th>
<th>CN</th>
</tr>
<tr>
<td>Anu</td>
<td>90</td>
<td>90</td>
<td>90</td>
</tr>
<tr>
<td>Aju</td>
<td>80</td>
<td>91</td>
<td>95</td>
</tr>
<tr>
<td>Anna</td>
<td>80</td>
<td>70</td>
<td>80</td>
</tr>
<tr>
<td>Anju</td>
<td>90</td>
<td>90</td>
<td>90</td>
</tr>
</table>
</center>
</body>
</html>
OUTPUT:
PROGRAM NO:3
Program:
Create a page with 2 links, one to the same page and to other page.
Code:
links.html
<html>
<head>
<title>links</title>
</head>
<body bgcolor="lightgreen">
An application program makes a system call to get the operating system to perform a
service for it, like reading from a file.<br><br>
The system call is the fundamental interface between an application and the Linux
kernel.<br><br><br>
<b><u>Process</u></b><br><br>
When you execute a program on your UNIX system, the system creates a special
environment for that program. This environment<br> contains everything needed for the
system to run the program as if no other program were running on the system.<br>
Whenever you issue a command in UNIX, it creates, or starts, a new process. When you
tried out the ls command to list directory<br> contents, you started a process. A process,
in simple terms, is an instance of a running program.<br>
The operating system tracks processes through a five digit ID number known as the pid or
process ID . Each process in the <br>system has a unique pid.<br>
Pids eventually repeat because all the possible numbers are used up and the next pid rolls
or starts over. At any one time,<br> no two processes with the same pid exist in the
system because it is the pid that UNIX uses to track each process.<br>
<br>Starting a Process<br>
When you start a process (run a command), there are two ways you can run it <br>
Background Processes<br><br><br>
</body>
</html>
fg.html
<html>
<head>
<title>links</title>
</head>
<body bgcolor="lightgreen">
<h1>Foreground Process</h1><br><br><br>
<p>The process runs in the foreground, the output is directed to my screen, and if the ls
command wants any input (which it does not), it waits for it from the <br>
keyboard.While a program is running in foreground and taking much time, we cannot run
any other commands (start any other processes) because prompt would not be
<br>available
</body>
</html>
OUTPUT:
PROGRAM NO:4
Program :
Print Railway timetable
Code:
<html>
<head></head>
<body>
<form>
height=500>
<tr>
</tr><tr>
<tr>
</tr>
<tr>
<tr>
</table>
</form>
</body>
</html>
OUTPUT:
PROGRAM NO:5
Program :
Create two links one for company profile and another for contact address of the company.
Code:
<html>
<p align="center">
</p>
<center>
<ahref="cn.html"><h1>Contact</h1></a>
</center>
</body>
</html>
CO.HTML
<html>
<body bgcolor=#FFC99">
<font color="red">
<h1>
<p align="left">
<br><br>
The mobile development community is at a tipping point. Mobile users demand more
choice, more opportunities to customize their phones, and more functionality. Mobile
lucrative way. Mobile developers want the freedom to develop the powerful mobile
applications users demand with minimal roadblocks to success. Finally, handset manufacturers
want a stable, secure, and affordable platform to power their devices. Upuntil now
single mobile platform has adequately addressed the needs of all the parties.
Enter Android, which is a potential game-changer for the mobile development community.
This explains what Android is, how and why it was developed, and where the
platform fits in to the established mobile marketplace.Memory was getting cheaper; batteries were
getting better; and PDAs and other
embedded devices were beginning to run compact versions of common operating systems
such as Linux and Windows.The traditional desktop application developer was suddenly
handsets, they needed to change their protectionist policies pertaining to handset design
creating applications for them. Some Smartphone devices ran Palm OS (now Garnet
OS) and RIM Blackberry OS. Sun Microsystems took its popular Java platform and
J2ME emerged (now known as Java Micro Edition [Java ME]). Chipset maker
Qualcomm developed and licensed its Binary Runtime Environment for Wireless
(BREW). Other platforms, such as Symbian OS, were developed by handset manufacturers
such as Nokia, Sony Ericsson, Motorola, and Samsung.The Apple iPhone OS (OS X
</p>
</h1>
</i>
</font>
</body>
</html>
CN.HTML
<html>
<body bgcolor="#FFCC99">
<font color="#CC3366">
<i>
<h1>
<h1>Contact us</h1>
</font>
</body>
</html>
OUTPUT:
PROGRAM NO:6
Program:
Create a page which makes use of HTML tags such as italic tag,center tag,paragraph
tag,break tag,font tag and its attributes.
Code:
<html>
<head>
<title>pgm</title>
</head>
<body bgcolor="lightgreen">
<h3><u>HTTP</u></h3>
<p><font color="blue" size="5">HTTP is the common language that web browser and
web server used to communicate with each other on the internet.</font></p>
<h3><u><i>HTML</i></u></h3>
<p>The language used to develop web pages is called HTML.HTML is the language
interpreted by a browser.
Web pages are also called htmldocuments.HTML is a set of special codes that can be
embedded in text to add formatting and linking
</body>
</html>
OUTPUT:
PROGRAM NO :7
Program:
Code:
<html>
<body>
<p>                     
         
java is a general purpose object oriented programming language developed by sun micro
system of USA in 1991.
Originally called oak by James Gosling . Java is a really simple, reliable, portable and
powerful language.
<p>                     
         
The most striking feature of the language is that it is a platform independent language.
Java features are compiled and interpreted.Platform independent and portable, object
oriented, robust and secure, distributed, multi threaded and interactive and element of java
language.</h4></p><br><br>
<p>                     
         
Computers are general purpose device that perform task or calculations according to a set
of instructions or programs. The first electronic digital computers developed between 1940
and 1945 in the UK and USA.
Computers are amazing, not only are they thousands of times faster, they can fit on your
desk, in your lap, or even in your pocket
The CPU is the most important component of a computer's hardware. The ALU and
Control unit together are termed as CPU. ALU performs arithmetic and logic operations.
CU interprets instructions and produce the respective control signals.</h4></font>
</p>
</body>
</html>
OUTPUT:
PHP PROGRAMS
PROGRAM NO.1
Program:
Code
<html>
<head>
<title>Hello</title>
</head>
</body>
<center><h1>
<?php
$d=date("D / M / Y");
date_default_timezone_set("Asia/Kolkata");
$t=date("h:i:s a");
echo $d."<br>";
echo $t;
?>
</h1></center>
</body>
</html>
OUTPUT:
PROGRAM NO.2
Program:
Code:
<html>
<title>Greetings</title>
<body>
<center><br><br><h2>
<?php
date_default_timezone_set("Asia/Kolkata");
$t=date("H:i a");
if($t<12)
elseif($t==12||$t==13)
echo"Good Afternoon...";
elseif($t>13&&$t<19)
echo"Eood Evening...";
else
echo"Good Night..."
?>
<h2></center>
</body>
</html>
OUTPUT:
PROGRAM NO.3
Program:
Code:
<html>
<title>Fibonacci Series</title>
<body
><h1><center>Fibonacci Series...<center></h1><br>
<tr>
</tr>
<tr>
<td></td>
<td ><h1>
</tr>
</table>
<center><h3>
<?php
if(isset($_POST["submit"]))
$m=0;
$r=1;
$l=$_POST['limit'];?><br>
<?php
if($l!=NULL)
echo $r;?><br>
<?php
$s=2;
while($s<$l)
$t=$m+$r;
echo $t;
?><br>
<?php
$m=$r;
$r=$t;
$s++;
?>
</center></h3></form>
</body>
</html>
OUTPUT:
PROGRAM 4
Program:
Write a script that count from 1 to 10 and display whether it is an even or odd number and
if it is a prime or not. Display this information within an html table.
Code:
<html>
<body><center>
<table border=1>
<tr><th>Number</th><th>Even</th><th>Odd</th><th>Prime</th></tr>
<?php
for($i=1;$i<=10;$i++)
$flag=0;
$n=$i%2;
?>
<tr><td>
<?php
echo $i;
?>
</td><td>
<?php
if($n==0)
echo 'yes';
else
echo 'no';
?>
</td><td>
<?php
if($n==1)
echo 'yes';
else
echo 'no';
?>
</td><td>
<?php
for($j=2;$j<=$i/2;$j++)
if($i%$j==0)
$flag=1;
break;
if($flag==0)
echo 'yes';
else
echo 'no';
?>
</td></tr>
<?php
?>
</table><center>
</body>
</html>
OUTPUT:
PROGRAM 5:
Program:
Code:
<html>
<head>
<title>Area</title>
</head>
<body><center>
<label><h1>.....Area.....</h1></label>
<tr><td></td><td></td></tr>
</center></form>
<?php
if(isset($_POST["circ"]))
$rad=$_POST['txtrad'];
$area=$rad*3.14;
?><center>
<?php
?></center>
<?php
if(isset($_POST["rect"]))
$len=$_POST['txtlen'];
$bre=$_POST['txtbre'];
$rectangle=$bre*$len;
?><center>
<?php
?>
</body>
</html>
OUTPUT:
PROGRAM 6:
Program:
Write a php script for the following:design a form to accept 2 numbers from the user.Give
option to choose the arithematic operations(use radio button)display the result.
Code:
<html>
<form method="post">
<br><br>
<br><br>
<br><br>
<br><br>
<br><br>
<br><br>
</form>
<?php
if(isset($_POST["submit"]))
$a =$_POST["op"];
$n1=$_POST["f1"];
$n2=$_POST["f2"];
$flag=1;
$ans;
if($a=="+")
$ans=$n1+$n2;
else if($a=="-")
$ans=$n1-$n2;
else if($a=='/')
$ans=$n1/$n2;
else if($a=="*")
$ans=$n1*$n2;
else
echo "invalid";
$flag=0;
if($flag!=0)
?>
</body>
</html>
OUTPUT:
PROGRAM 7:
Program:
Write a php script for the following. Design a form to accept the details of 3 different
items. Such as item code ,item name , unit sold ,rate ,display the bill in the tabular
format(Use only 4 text box).
Code:
Item.php
<html>
<body>
<p> :</p>
<tr>
<td><label>
</label></td>
</tr>
<tr>
<td><label>
</label></td>
</tr>
<tr>
<td><label>
</label></td>
</tr>
<tr>
<td><label>
</label></td>
</tr>
<tr>
<td> </td>
<td><label>
</label></td>
</tr>
</table>
<p> :</p>
</form>
</body>
</html>
<?php
if($_POST['SUBMIT']!="")
$code=$_POST['code'];
$name=$_POST['name'];
$unit=$_POST['unit'];
$rate=$_POST['rate'];
$amount=$unit*$rate;
$con=mysql_connect("localhost","root","");
if(!$con)
echo"not connected";
mysql_select_db("item",$con);
if($sel)
?>
<script type="text/javascript">
alert("added Successfully");
</script>
<?php
mysql_close();
if($_POST['bill']!="")
header("location:itemm2.php")
?>
itemm2.php
<html>
<head></head>
<body>
<tr>
<td width="109">rate</td>
<td width="90">amount</td>
</tr><tr>
<?php
$k=1;
$r=1;
$amt1=0;
$con=mysql_connect("localhost","root","");
if(!$con)
echo"not connected";
mysql_select_db("item",$con);
while($row=mysql_fetch_array($result))
$amt=$row['unit']*$row['rate'];
?>
</tr>
<?php
?>
<p> </p>
<p> </p>
<p>
<?php
$r=mysql_fetch_array($sum)
?>
<tr>
<td width="55"> </td>
<td width="78"> </td>
<td width="58"> </td>
</tr>
</table>
</p>
</body>
</html>
Item.sql
--
-- Database: `item`
--
-- --------------------------------------------------------
--
-- Table structure for table `itemtable`
--
--
-- Dumping data for table `itemtable`
--
-- --------------------------------------------------------
--
-- Table structure for table `log1`
--
--
-- Indexes for dumped tables
--
--
-- Indexes for table `itemtable`
--
ALTER TABLE `itemtable`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `log1`
--
ALTER TABLE `log1`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `itemtable`
--
ALTER TABLE `itemtable`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=22;
--
-- AUTO_INCREMENT for table `log1`
--
OUTPUT:
PROGRAM 8:
Program:
Write string design a form to accept 2 strings. Compare the 2 string using both
methods(== and strcmp function), append second string to the first string. accept second
string to the first string. Accept the position from the user: from where the character from
the are reversed.(use radio button).
Code:
<html>
<head>
</head>
<body>
<tr>
<td width="144"><label>
</label></td>
</tr>
<tr>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><label>
compare with==</label></td>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<label>
</label></td>
</tr>
<tr>
<td> </td>
<td>
<label>
</label></td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
</form>
<div align="center">
<?php
if(isset($_POST['Submit']))
$pos=$_POST['pos'];
$s1=$_POST['s1'];
$s2=$_POST['s2'];
$radio=$_POST['radiobutton'];
if($radio=="oper")
if($s1==$s2)
else
}}
else if($radio=="string")
$r=strcmp($s1,$s2);
if($r)
else
else if($radio=="append")
echo $s1.$s2;
else
$f=substr($s1,0,$pos);
$rev=strrev($f);
echo $rev;
?>
</div>
</body>
</html>
OUTPUT:
PROGRAM 9:
Program:
Code:
mark.php
<html>
<title>Marks</title>
<head>
</head>
<body>
<tr>
<p> </p>
<p><h2>Student Details</h2></p>
<p> </p>
</div></td>
</tr>
<tr>
<td width="85">Name</td>
<td width="186">
</td>
</tr>
<tr>
<td>Class</td><td>
</td>
</tr>
<tr>
<td height="66">Address</td>
<td>
<textarea name="textarea"></textarea></td>
</tr>
<tr>
<p> </p>
<p><h2>Marks Obtained</h2></p>
<p> </p>
</div>
</td>
</tr>
<tr>
<td>Biology</td>
</td>
</tr>
<tr>
<td>Physics</td>
</td>
</tr>
<tr>
<td>Chemistry</td>
</td>
</tr>
<tr>
<td>Maths</td>
</td>
</tr>
<tr>
<td>Marathi</td>
</td>
</tr>
<tr>
<td>English</td><td>
</td>
</tr>
<tr></tr>
<tr><td></td>
<td>
</td>
</tr>
</table>
</form>
</body>
</html>
mark1.php
<html>
<head></head>
<body>
<?php
$name=$_POST['name'];
$class=$_POST['class'];
$bio=$_POST['bio'];
$phy=$_POST['phy'];
$che=$_POST['che'];
$m=$_POST['m'];
$mara=$_POST['mara'];
$eng=$_POST['eng'];
$tot=$bio+$phy+$che+$m+$mara+$eng;
$max=300;
$perc=($tot/$max)*100;
?>
<tr>
<td colspan="6"><h2><center>
<p> </p>
<p>..Student Details..</p>
</center></h2>
<div align="center">
</tr>
<tr>
</tr>
<tr>
</tr>
<tr></tr>
<tr>
Marks Obtained</div></td>
</tr>
<tr>
<td colspan="3">Biology</td>
</tr>
<tr>
<td colspan="3">Physics</td>
</tr>
<tr>
<td colspan="3">Chemistry</td>
</tr>
<tr>
<td colspan="3">Maths</td>
</tr>
<tr>
<td colspan="3">Marathi</td>
</tr>
<tr>
<td colspan="3">English</td>
</tr>
<tr></tr>
<tr>
</tr>
<tr>
</tr>
<tr>
<td colspan="3">Percentage</td>
</tr>
</table></center>
</form>
</body>
</html>
OUTPUT:
PROGRAM 10:
Program:
Write a PHP script to accept username and password.If in the first chance username and
password entered is correct,then display second form,otherwise display error message.
Code:
Msclog.php
<html>
<head>
</head>
<body>
<p> </p>
<p> </p>
<tr>
<td width="177"><label>
</label></td>
</tr>
<tr>
<td>password</td>
<td><label>
</label></td>
</tr>
<tr>
<td> </td>
<td><label>
</label></td>
</tr>
</table>
<p>< </p>
</form>
</body>
</html>
Msclog1.php
<html>
<head>
</head>
<body>
</body>
</html>
<?php
$k=0;
$a=$_POST['user'];
$a=$_POST['pswd'];
$con=mysql_connect("localhost","root");
if(!$con)
else
echo"coon";
mysql_select_db("login1" .$con);
while($row=mysql_fetch_array($res))
$user=$row[0];
$pswd=$row[1];
$count=$row[2];
header("location:oper.php");
break;
else
$c=$count+1;
echo $c;
if($count<3)
else
echo "blocked";
header("location:fff.php");
mysql_close($con);
?>