Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
89 views

Lab 1 Write A HTML Code To Demonstrate Various Formatting Tags, Ordered and Unordered List, and Table Using Frames Suitably. Home - HTML

The document describes creating HTML pages for a web programming lab assignment. It includes code to: 1. Create a homepage with frames to navigate different pages. 2. Pages demonstrating formatting tags, ordered and unordered lists, and tables. 3. A left menu linking to the different demonstration pages. The assignment requires creating an institute website, department website, and tutorial website for a subject using HTML and JavaScript. Code provided displays a resume using these technologies.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
89 views

Lab 1 Write A HTML Code To Demonstrate Various Formatting Tags, Ordered and Unordered List, and Table Using Frames Suitably. Home - HTML

The document describes creating HTML pages for a web programming lab assignment. It includes code to: 1. Create a homepage with frames to navigate different pages. 2. Pages demonstrating formatting tags, ordered and unordered lists, and tables. 3. A left menu linking to the different demonstration pages. The assignment requires creating an institute website, department website, and tutorial website for a subject using HTML and JavaScript. Code provided displays a resume using these technologies.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

Web Programming Lab

Lab 1
Write a HTML code to demonstrate various formatting tags, ordered and unordered
list, and table using frames suitably.
Home.html
<html>
<head>
<title>Home page</title>
</head>
<frameset rows="20,80">
<frame src="head.html" name="head_page" noresize="noresize">
<frameset cols="15,85">
<frame src="leftmenu.html" name="dept_page" noresize="noresize">
<frame src="main.html" name="design_page" noresize="noresize">
</frameset>
</frameset>
</html>
Head.html
<html>
<head>
<title>Description page </title>
</head>
<body>
<br><br><br><br><br><br><br><br><br>
<font face="Times New Roman" size="5">
<center>
Demonstrate varios formatting tags using frame suitably
</center>
</font>
</body>
</html>

1
Web Programming Lab

Ordered list
<html>
<head>
<title>Ordered List</title>
</head>
<body>
<br><br><br><br><br><br><br>
<font face="Times New Roman" size="5">
<p>Ordered List</p>
<p>Numbers:</p>
<ol type="1">
<li>BCA</li>
<li>BBA</li>
<li>PUC</li>
</ol>
</p>
</font>
</body>
</html>

2
Web Programming Lab

Unordered list
<html>
<head>
<title>Unordered lisr</title>
</head>
<body>
<br><br><br><br><br><br><br>
<font face="Times New Roman"size="5">
<center>
<p>Unordered list</p>
<p>square letters:<p>
<ul type="square">
<li>Bijapur</li>
<li>Mangalore</li>
<li>Mysore</li>
</ul>
</p>
</center>
</font>
</body>
</html>

3
Web Programming Lab

Leftmenu.html
<html>
<head>
<title>Formatting Tags</title>
</head>
<body>
<font face="Arial blacks" size="4">
<table align="center" height="100%">
<tr>
<td><a href="Formatting.html"
target="design_page"> Formatting tags </a>
</td>
</tr>
<tr>
<td><a href="Ordered.html"
target="design_page">ordered list </a></td>
</tr>
<tr>
<td><a href="Unordered.html"
target="design_page">Unordered list </a> </td>
</tr>
<fr>
<td><a href="Table.html" target="design_page">
Tables</a></td>
</tr>
</table>
</font>
</body>
</html>

4
Web Programming Lab

Table.html
<html>
<head>
<title>Table</title>
</head>
<body>
<br><br><br><br><br><br>
<font face="Times New Roman"size="5">
<center>
<table border="3" cellpadding="8" cellspacing=" 10">
<tr>
<th>subject code</th>
<th>subject title</th>
<th>theory/practical</th>
<th>IA</th>
</tr>
<tr>
<td>cs0001</td>
<td>c++</td>
<td>80</td>
<td>20</td>
</tr>
<tr>
<td>cs0001</td>
<td>java</td>
<td>80</td>
<td>20</td>
</tr>
<tr>
<td>cs0002</td>

5
Web Programming Lab

<td>J2EE</td>
<td>80</td>
<td>20</td>
</tr>
<tr>
<td>cs0003</td>
<td>Python</td>
<td>80</td>
<td>20</td>
</tr>
</table>
</center>
</font>
</body>
</html>

6
Web Programming Lab

Formatting.html
<html>
<head>
<title>Formatting Tag</title>
</head>
<body>
<br><br><br><br><br><br><br><br><br><br>
<font face="Times New Roman" size="5">
<center>
<p>Formatting Tags</p>
<p><b>bold</b></p>
<p><i>italic</i></p>
<p><strike>strike</strike></p>
<p>superscriptx<sup>2</sup></p>
</center>
</font>
</body>
</html>

7
Web Programming Lab

Output:

8
Web Programming Lab

9
Web Programming Lab

Lab 2
Write HTML/JavaScript to display your CV in navigator, your Institute website,
Department
Website and tutorial website for specific subject.
a) Write HTML/JavaScript to display your CV in navigator
cv.html
<html>
<head>
<h1 align=center><u>RESUME</u></h1>
</head>
<body>
<h2><b><font color="black">Address</font></B><BR></h2>
<pre><font color="black" size=5>
<i>Chetana college Hostel Vijayapur=586101</i>
<I>PHONE NO:</I>9731454428
<i>EMAIL:</i><a href="">iz_sadiq@yahoo.co.in</a>
</font></pre>
<hr size=10 width=100% noshade>
<h2 align=center><u>CAREER OBJECTIVE</u></h2>
<font size=5>To work with a fast growing organisation,where i can learn,achieve
professional excellence and implement my technical skills.</font>
<br><br><br>
<hr size=10 width=100% noshade>
<h2 align=center><u>ACADEMIC BACKGROUND</u></h2>
<table border=7pt cellspacing=0 cellpadding=30 width=25% align=center>
<tr>
<th>YEAR</th>
<th>COURSE</th>
<th>UNIVERSITY/BOARD</th>
<th>SCHOOL</th>
<th>PERCENTAGE</th>

10
Web Programming Lab

</tr>
<tr>
<td align=left>2015-2019</td>
<td align=right>B.TECH(INSORMATION TECHNOLOGY)</td>
<td align=center>RCU</td>
<td align=center>Chetana</td>
<td align=center>72%</td>
</tr>
<tr>
<td align=left>2014</td>
<td align=right>12 th</td>
<td align=center>CBSE </td>
<td align=center>Chetana SCHOOL</td>
<td align=center>76%</td>
</tr>
<tr>
<td align=left>2012</td>
<td align=right>10 th </td>
<td align=center>CBSE </td>
<td align=left>Chetana SCHOOl</td>
<td align=center>10 CGPA</td>
</tr>
</table>
<hr size=10 width=100% noshade><br><br>
<he align=center><u>INDUSTRIAL CERIFICATION</u></h2>
<font size=5>
<ul>
<li>IOS APP DEVELOPMENT
<li>ISO CERTIFIED-ANDROID APP DEVELOPMENT
<li>ISO CERTIFIED-CORE JAVA

11
Web Programming Lab

</ul>
</font>
<hr size=10 width=100% noshade><br><br>
<h2 align=center><u>COMPUTER AWARENESS</u></h2>
<font size=5>
<ul>
<li>HTML & CSS
<li>C
<li>C++
<li>JAVA
</ul></font>
<hr size=10 width=100% noshade><br><br>
<h2 align=center><u>CO-CURRICULAR ACTIVITY</u></h2>
<font size=5>
<ul>
<li>Participated in MATHS OLYMPAID
<li>Participated in INTER SCHOOL COMPETITION
<li>Participated in various DRAMAS & QUIZS COMPETITION
</ul>
</font>
<hr size=10 width=100% noshade><br><br>
<h2 align=center><u>EXTRA-CURRICULAR ACTIVITIES</u></h2>
<font size=5><ul>
<li>Video editing
<li>Listening songs
<li>Reading newspapers
</ul></font>
<hr size=10 width=100% noshade><br><br>
<h2 align=center><u>PERSONAL DETAILS</u></h2>
<BR><BR>

12
Web Programming Lab

<pre><FONT COLOR="black" size=5>


NAME : xyz
D.O.B : 23/10/1997
FATHERS'S NAME : xyz
MOTHER'S NAME : xyz
CATEGORY : OBC
GENDER : MALE
MARITAL STATUS : SINGLE
NATIONALITY : INDIAN
PERMANENT ADDRESS : chetana college Darga road vijayapur
DIST : Vijayapur
STATE : Karnataka
</font>
<BR><BR>
<font color="red" size=5>I here by declare that the above written particulars are true to the
best of my knowledge and belief.</font>
<font sizw=5> <br/>xyz
PLACE:GREATER Vijayapur</font>
</font></pre>
</body></html>

13
Web Programming Lab

Output:

14
Web Programming Lab

b) Write HTML/JavaScript to display an Institute website, Department Website


Tutorial website for specific subject.
default.html
<html>
<head>
<h1 align=center><u>RESUME</u></h1>
</head>
<body>
<h2><b><font color="black">Address</font></B><BR></h2>
<pre><font color="black" size=5>
<i>Chetana college Hostel Vijayapur=586101</i>
<I>PHONE NO:</I>9731454428
<i>EMAIL:</i><a href="">iz_sadiq@yahoo.co.in</a>
</font></pre>
<hr size=10 width=100% noshade>
<h2 align=center><u>CAREER OBJECTIVE</u></h2>
<font size=5>To work with a fast growing organisation,where i can learn,achieve
professional excellence and implement my technical skills.</font>
<br><br><br>
<hr size=10 width=100% noshade>
<h2 align=center><u>ACADEMIC BACKGROUND</u></h2>
<table border=7pt cellspacing=0 cellpadding=30 width=25% align=center>
<tr>
<th>YEAR</th>
<th>COURSE</th>
<th>UNIVERSITY/BOARD</th>
<th>SCHOOL</th>
<th>PERCENTAGE</th>
</tr>
<tr>

15
Web Programming Lab

<td align=left>2015-2019</td>
<td align=right>B.TECH(INSORMATION TECHNOLOGY)</td>
<td align=center>RCU</td>
<td align=center>Chetana</td>
<td align=center>72%</td>
</tr>
<tr>
<td align=left>2014</td>
<td align=right>12 th</td>
<td align=center>CBSE </td>
<td align=center>Chetana SCHOOL</td>
<td align=center>76%</td>
</tr>
<tr>
<td align=left>2012</td>
<td align=right>10 th </td>
<td align=center>CBSE </td>
<td align=left>Chetana SCHOOl</td>
<td align=center>10 CGPA</td>
</tr>
</table>
<hr size=10 width=100% noshade><br><br>
<he align=center><u>INDUSTRIAL CERIFICATION</u></h2>
<font size=5>
<ul>
<li>IOS APP DEVELOPMENT
<li>ISO CERTIFIED-ANDROID APP DEVELOPMENT
<li>ISO CERTIFIED-CORE JAVA
</ul>
</font>

16
Web Programming Lab

<hr size=10 width=100% noshade><br><br>


<h2 align=center><u>COMPUTER AWARENESS</u></h2>
<font size=5>
<ul>
<li>HTML & CSS
<li>C
<li>C++
<li>JAVA
</ul></font>
<hr size=10 width=100% noshade><br><br>
<h2 align=center><u>CO-CURRICULAR ACTIVITY</u></h2>
<font size=5>
<ul>
<li>Participated in MATHS OLYMPAID
<li>Participated in INTER SCHOOL COMPETITION
<li>Participated in various DRAMAS & QUIZS COMPETITION
</ul>
</font>
<hr size=10 width=100% noshade><br><br>
<h2 align=center><u>EXTRA-CURRICULAR ACTIVITIES</u></h2>
<font size=5><ul>
<li>Video editing
<li>Listening songs
<li>Reading newspapers
</ul></font>
<hr size=10 width=100% noshade><br><br>
<h2 align=center><u>PERSONAL DETAILS</u></h2>
<BR><BR>
<pre><FONT COLOR="black" size=5>
NAME : xyz

17
Web Programming Lab

D.O.B : 23/10/1997
FATHERS'S NAME : xyz
MOTHER'S NAME : xyz
CATEGORY : OBC
GENDER : MALE
MARITAL STATUS : SINGLE
NATIONALITY : INDIAN
PERMANENT ADDRESS : chetana college Darga road vijayapur
DIST : Vijayapur
STATE : Karnataka
</font>
<BR><BR>
<font color="red" size=5>I here by declare that the above written particulars are true to the
best of my knowledge and belief.</font>
<font sizw=5> <br/>xyz
PLACE:GREATER Vijayapur</font>
</font></pre>
</body></html>

C1.html
<html>
<head>
<title>Chetana</title>
</head>
<body text=BLACK bgcolor=RED>
<font size=5>
<marquee behavior=alternate>.......ABOUT CHRTANA COLLEGE.....</MARQUEE><pre>
Overview
CHETANA INSTITUTE is ine of the prestigious education institution of Bijapur.<br>
It was established in the year 2007 by an inspired band of enthusiastic young men fired with
ambition of serving the cause of quality education in North Karnataka.

18
Web Programming Lab

<br> With this idea the management started an education Trust wuth the name CHETANA
EDUCATION SOCIETY Memorial Trust,Bijapur.
professional courses like MBA,MCA,PGDCA,M.Sc(Computer Science) and so on.
<a href=default.html>BACK TO HOME</a>
</pre>
</font>
</body>
</html>

19
Web Programming Lab

Course.html
<html>
<head>
<title>COURSES OFFERED</title>
</head>
<body BGCOLOR=orange>
<marquee behavior=alternate>......COURSES NAME.....</marquee><BR><br>
<marquee behavior=alternate>......DURATION.......</marquee><br><br>
<marquee behavior=alternate>......FEES......</marquee><br><br>
<table border=7pt cellspacing=20 cellpadding=30 width=25% align=center>
<tr>
<th>COURSES NAME </th>
<th>DURATION </th>
<th>FEES(in Lacs) </th>
</tr>
<tr>
<td align=left>B Tech</td>
<td align=right> 4 YRS</td>
<td align=center> 5</td>
</tr>
<tr>
<td align=left>MCA</td>
<td align=right>2 Yrs.</td>
<td align=center>6</td>
</tr>
<tr>
<td align=left>MBA</td>
<td align=right>2 Yrs.</td>
<td align=center>6</td>
</tr>

20
Web Programming Lab

<yr>
<td align=left>PGDM</td>
<td align=right>2YRS.</td>
<td align=center>6</td>
</tr>
</table>
</html>

21
Web Programming Lab

Gallery.html
<html>
<head>
<title>gallery of c1</title>
</head>
<body>
<pre>
<img scr=e:\1.jpg><br><br>
<img src=e:\2.jpg><img src=e:\3.jpg><br><br>
<img src=e:\3.jpg><img src=e:\4.jpg><br>
<img src=e:\4.jpeg>
<a href=default.html>BACK TO HOME</A>
</pre>
</body>
</html>

22
Web Programming Lab

Registration.html
<html>
<head><title>forms</title></head>
<body BGCOLOR=ORANGE>
<forms method=get action="http://www.ces.com">
enter your name:<input type=text name=ag size=3><br>
<forms method=get action="http://www.ces.com">
enter your name:<input type=text name=fnm size=20><br>
enter your age:<input type=text name=ag size=3><br>
password:<input type=password name=pw size=12><br>
sex:<br>
<input type=radio name=s>Male <input type=radio name=s>Female <br>
<input type=checkbox name=ms> Interested in Music <br>
Address:
<br><textarea name=ad rows=5 cols=20>Write your address here
</textarea><br>
State:<select>
<option>KA</option>
<option>MH</option>
<option>UP</option>
<option>West Bengal</option>
</select>
<br><br><br>
<input type=submit value=Send> <input type=Refresh value=Clear><BR>
<a href=default.html>BACK TO HOME</a>
</body>
</html>

23
Web Programming Lab

Output:

24
Web Programming Lab

25
Web Programming Lab

26
Web Programming Lab

Lab3
Develop and demonstrate a XHTML document that illustrates the use external style
sheet, ordered list, table, borders, padding, color, and the tag.
Style.css
p,table,li,
{
font-family:"lucida calligraphy",arial,'sans serif';
margin-left:10pt;
}
p{word-spacing:5px;}
body{background-color:rgb(200,255,205);}
p,li,td{font-size:75%;}
td{padding:0.5cm;}
th{
text-align:center;
font-size:85%;
}
h1,h2,h3,hr{color:#483d8b;}
table
{
border-style:outset;
background-color:rgb(100,255,105);
}
li{list-style-type:lower-roman;}
span
{
color:blue;
background-color:pink;
font-size:29pt;
font-style:italic;

27
Web Programming Lab

font-weight:bold;
}
Lab3.html
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="style.css"/>
<title>lab program1</title>
</head>
<body>
<h1>This header is 36 pt</h1>
<h2>This header is blue</h2>
<p>This paragraph has a left margin of 50pixels </p>
<table border="4" width="5%"><!--table with name & email-->
<tr>
<th width="204"> Name</th>
<th>Email</th>
</tr>
<tr>
<td width="204">XYZ</td>
<td>abc@pes.edu</td>
</tr>
<tr>
<td width="204"> Dr.MKV</td>
<td>xyz@rediffmail.com</td>
</tr>
<tr>
<td width="204">MNO</td>

28
Web Programming Lab

<td>aaa@yahoo.co.in</td>
</tr>
<tr>
<td width="204">ABC</td>
<td>ces@gmail.com</td>
</tr>
</table>
<hr>
<ol>
<li>BCA</li>
<li>BBA</li>
<li>PUC</li>
</ol>
<p>
<span>This is a text.</span>This is a text.This is atext.This is a text.This is a text.This is a
text.This is a text.This is atext.This is a text.<span>This is a text.</span>
</p>
</body>
</html>

29
Web Programming Lab

Output:

30
Web Programming Lab

Lab 4
Create a HTML form containing Textboxes to enter name of student, roll number,
course, and grade obtained. When the form runs in the Browser fill the textboxes with
data. Write JavaScript code that verifies that all textboxes has been filled. If a textboxes
has been left empty, popup an alert indicating which textbox has been left empty.
<html>
<head>
<title>Registration Form</title>
<script type="text/javascript">
function validate()
{
if(document.myForm.Name.value == "")
{
alert("please provide your name");
document.myForm.Name.focus();
return false;
}
if(document.myForm.Email.value == "")
{
alert("please provide your email id");
document.myForm.Email.focus();
return false;
}
if((document.myForm.Zip.value == "") || (document.myForm.Zip.value.length != 5))
{
alert("please provide a valid zip code format #####");
document.myForm.Zip.focus();
return false;
}
if(document.myForm.Country.value=="-1")
{

31
Web Programming Lab

alert("please provide your country name");


return false;
}
return true;
}
function validateEmail()
{
var emailID=document.myForm.Email.value;
atpos=emailID.indexOf("@");
dotpos=emailID.lastIndexOf(".");
if(atpos<1||(dotpos-atpos<2))
{
alert("please enter correct email id ");
document.myForm.Email.focus();
return false;
}
return true;
}
</script>
</head>
<body>
<form name="myForm"onsubmit="return(validate());">
<table cellspacing="2"cellpadding="2"border="1">
<tr>
<td>Name</td>
<td><input type="text"name="Name"/></td>
</tr>
<tr>
<td>Email ID</td>
<td><input type="text" name="Email" onchange="validateEmail();"/></td>

32
Web Programming Lab

</tr>
<tr>
<td>Zip Code</td>
<td><input type="text" name="Zip"/></td>
</tr>
<tr>
<td>Country</td>
<td><select name="Country">
<option value="-1"selected>[choose yours]</option>
<option value="1">India</option>
<option value="2">USA</option>
<option value="3">Srilanka</option>
</select>
</td>
</tr>
<tr>
<td colspan="2" align = "center"><input type = "submit" value= "submit" /></td>
</tr>
</table>
</form>
</body>
</html>

33
Web Programming Lab

Output:

34
Web Programming Lab

Lab 5
Develop and demonstrate a XHTML file that includes JavaScript script for receiving a
number n as input and outputting first n Fibonacci numbers.
<html>
<head>
<title>Program2a</title>
</head>
<script type="text/javascript">
function fib()
{
var n=prompt("Enter N:","");
fib1=0;
fib2=1;
fib=0;
document.write("<h2>"+fib1+"\n</h2>");
document.write("<h2>"+fib2+"\n</h2>");
for(i=0;i<n;i++)
{
fib=fib1+fib2;
fib1=fib2;
fib1=fib2;
fib2=fib;
document.write("<h2>"+fib+"\n</h2>");
}}
</script>
<body onload="fib()">
</body>
<html>

35
Web Programming Lab

Output:

36
Web Programming Lab

Lab 6
Write a JavaScript code to compute the sum of n natural numbers.
<html>
<head>
<script type="text/javascript">
var num=window.prompt("Enter the number:","");
var n=parseInt(num);
result=sumnaturalno(n);
window.alert("The sum of " + n + " natural number is " +result);
function sumnaturalno(n)
{
var i;
var sum=0;
for(i=1;i<=n;i++)
{
sum=sum+i;
}
return(sum);
}
</script>
</head>
</html>

37
Web Programming Lab

Output:

38
Web Programming Lab

Lab 7
Create a HTML form containing textbox to enter text. Write a JavaScript code block,
which checks the contents entered in a form’s Text element. If the text entered is in the
lower case, convert to upper case. Make use of function to Uppercase ( ).
<html>
<head>
<script type="text/javascript">
function upper()
{
var upper=document.form1.string.value.toUpperCase();
document.form1.string.value=upper;
}
</script>
</head>
<body>
<form name = "form1">
<table>
<tr>
<td>Enter String</td>
<td><input type="text" name="string"/></td>
</tr>
<tr>
<td><input type="button" value="upper" onclick="upper()"></td>
</tr>
</table>
</form>
</body>
</html>

39
Web Programming Lab

Output:

40
Web Programming Lab

Lab 8
Design an XML document to store information about an Employee viz. Name, EmpId,
Job, Department and position. Make up sample data for 3 employees. Create a CSS
style sheet and use it to display the document.
Xml
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="ces.css"?>
<students>
<h2>INFORMATION ABOUT EMPLOYEES</h2>
<RCU>
<p>
EMPID:<empid>STP10111</empid>
</p>
<p>
Name:<name>XYZ</name>
</p>
<p>
JOB:<job>Networking Engineer</job>
</p>
<p>
DEPARTMENT:<dept>HARDWARE DEPARTMENT</dept>
</p>
<p>
POSITION:<pos>Networking Engineer</pos>
</p>
<p>
<white>white text</white>
</p>
</RCU>
<RCU>
<p>

41
Web Programming Lab

EMPID:<empid>STP10112</empid>
</p>
<p>
Name:<name>ABC</name>
</p>
<p>
JOB:<job>Marketing Manager</job>
</p>
<p>
DEPARTMENT:<dept>Marketing</dept>
</p>
<p>
POSITION:<pos>Marketing Manager</pos>
</p>
<p>
<white>white text</white>
</p>

</RCU>
<RCU>
<p>
EMPID:<empid>STP10113</empid>
</p>
<p>
Name:<name>MNO</name>
</p>
<p>
JOB:<job>Web Developer</job>
</p>
<p>

42
Web Programming Lab

DEPARTMENT:<dept>Software</dept>
</p>
<p>
POSITION:<pos>Web Developer</pos>
</p>
<p></p>
<p>
</p>
</RCU>
</students>

43
Web Programming Lab

ces.css
h2{
font-family:"lucida calligraphy",arial,'sans serif';
margin-lefr:10pt;
font-size:29pt;
}
white
{color:white;}
p
{display:block;}
empid{
color:blue;
font-style:italic;
}
name{
color:blue;
font-style:italic;
}
job{
color:blue;
font-style:italic;
}
dept{
color:blue;
font-style:italic;
}
pos{
color:blue;
font-style:italic;
}

44
Web Programming Lab

Output:

45
Web Programming Lab

Lab 9 :
Create a 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.
<html>
<h2>Insert info</h2>
<form action="insert.php">
Name:<input type=text name=name/> <br>
Address Line1:<input type=text name=addr1><br>
Address Line2:<input type=text name=addr1><br>
Email-ID:<input type=text name=email> <br>
<input type=submit value=insert/>
<input type=reset value=reset/>
</form>
<h2>Search info</h2>
<form action="search.php">
Name:<input type=text name=name/><br>
<input type=submit value=search/>
<input type=reset value=reset/>
</form>
</html>

46
Web Programming Lab

Insert.php
<?php
$name=$_REQUEST['name'];
$addr1=$_REQUEST['addr1'];
$addr2=$_REQUEST['addr2'];
$addr1=$_REQUEST['addr1'];
$email=$_REQUEST['email'];
$con=mysql_connect("localhost") or die('Cloud not connect');
mysql_select_db("test",$con);
if(mysql_query("insert into student values('$name',$addr1','$addr2','$email')"))
{
echo "Data inserted successfully!";
}
mysql_close($con);
?>

47
Web Programming Lab

Search.php
<html>
<h2>Search Result</h2>
<table border=1>
<tr>
<th>Name</th>
<th>Address Line1</th>
<th>Address Line2</th>
<th>Email-ID</th>
</tr>
<?php
$name=$_REQUEST['name'];
$con=mysql_connect("localhost") or die('Cloud not connect');
mysql_select_db("test",$con);
$result=mysql_query("select * from student where name like '%".$name."%'");
while($row=mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>".$row['name']."</td>";
echo "<td>".$row['addr1']."</td>";
echo "<td>".$row['addr2']."</td>";
echo "<td>".$row['email']."</td>";
echo "</tr>";
}
mysql_close($con);
?>
</table>
</html>

48
Web Programming Lab

e=$_REQUEST['name'];
$addr1=$_REQUEST['addr1'];
$addr2=$_REQUEST['addr2'];
$addr1=$_REQUEST['addr1'];
$email=$_REQUEST['email'];
$con=mysql_connect("localhost") or die('Cloud not connect');
mysql_select_db("test",$con);
if(mysql_query("insert into student values('$name',$addr1','$addr2','$email')"))
{
echo "Data inserted successfully!";
}
mysql_close($con);
?>

49

You might also like