SlideShare a Scribd company logo
1 of 49
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
1)The document must have a paragraph of text that describes yourhome. Choose at least three
different phrases (3 to 6 words) of this paragraph and make them change font, font style,
color and font size when the mouse cursor is placed over them. Each of the different phrases
must change to different fonts, font styles, colors and font sizes.
<!-------changecolorfont------>
<?xml version="1.0" encoding="utf-8"?>
<html>
<head>
<title>Dynaamic fonts for link</title>
<style type="text/css">
.regText{font:Times;font-size:14pt;}
</style>
</head>
<body>
<p clss="regText">
My Home Name Is
<b style="color:blue;"
onmouseover="this.style.color='red';
this.style.font='italic 16pt Tahoma';"
onmouseout="this.style.color='blue';
this.style.font='normal 16pt Times';">
Basava Krupa
</b>.It is lacated nearby Govt polytechnic college,
In Basav nagar,
<b style="color:blue;"
onmouseover="this.style.color='orange';
this.style.font='bold 16pt Arial';"
onmouseout="this.style.color='blue';
this.style.font='normal 16pt Times';">
Bijapur
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
</b>.My house is facing Towards
<b style="color:pink;"
onmouseover="this.style.color='red';
this.style.font='italic 16pt Tahoma';"
onmouseout="this.style.color='blue';
this.style.font='normal 16pt Times';">
East
</b>.It is double bed home.there is a 16 foot road in front of
the home.
There is a sufficient place for
<b style="color:brown;"
onmouseover="this.style.color='yellow';
this.style.font='italic 16pt Tahoma';"
onmouseout="this.style.color='blue';
this.style.font='normal 16pt Times';">
gardening
</b>.and car motor cycle parking,it is built in the
<u style="color:gray;"
onmouseover="this.style.color='brown';
this.style.font='italic 16pt Tahoma';"
onmouseout="this.style.color='blue';
this.style.font='normal 16pt Times';">
Area 45x40 squire foot
</u>.
</p>
</body>
</html>
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
**OUTPUT**
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
2)The document must contain fourshort paragraphs of text stacked on top of each other with
only enough of each showing so that the mouse cursor can also be placed oversome part of
them. When the cursor is placed over the exposed part of any paragraph it should raise to the
top to become completely visible.
<!----Stcking.html---->
<?xml version="1.0" encoding="utf-8"?>
<html>
<head>
<title>Dynamic stackin Paragraph</title>
<script type="text/javascript" src="stacking.js">
</script>
<style type="text/css">
.para1 {color:red;position:absolute; top: 10px; left: 10px;
z-index: 0;background-color:yellow}
.para2 {color:green;position:absolute; top: 30px; left: 100px;
z-index: 0;background-color:gray}
.para3 {color:black;position:absolute; top: 50px; left: 200px;
z-index: 0;background-color:white}
.para4 {color:brown;position:absolute; top: 70px; left: 300px;
z-index: 0;background-color:pink}
</style>
</head>
<body>
<p class="para1" id='p1' onmouseover="toTop('p1');">
A dynamic Xhtml document,which can be modifiedeither
while it is being displayed or after it has been
displayed.
more Specifically,A dynamic xhtml is one whose tag attributes,
tag contents are elements stylemore Specifically,A dynamic xhtml is
one whose tag attributes, tag contents are elements style
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
properties can changed after the documents has been displayed
or while is being displayed.
</p>
<p class="para2" id='p2' onmouseover="toTop('p2');">
The default layout of XHTML elements in the documents is from left
to right
in the way text is placed in any text editor . when the row is filled ,laying out
The default layout of XHTML elements in the documents is from left
to right
in the way text is placed in any text editor . when the row is filled ,laying out
</p>
<p class="para3" id='p3' onmouseover="toTop('p3');">
A dynamic Xhtml document,which can be modifiedeither
while it is being displayed or after it has been displayed.
more Specifically,A dynamic xhtml is one whose tag attributes,
tag contents are elements style
properties can changed after the documents has been displayedor while is being displayed.
</p>
<p class="para4" id='p4' onmouseover="toTop('p4');">
A dynamic Xhtml document,which can be modifiedeither
while it is being displayed or after it has been displayed.
more Specifically,A dynamic
xhtml is one whose tag attributes,
tag contents are elements style
properties can changed after the documents has been displayedor while is being displayed.
</p>
</body>
</html>//stacking.js
var oldTop="p1";
function toTop(newTop)
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
{
domTop = document.getElementById(oldTop).style;
domNew = document.getElementById(newTop).style;
domTop.zIndex = "0";
domNew.zIndex = "10";
oldTop = newTop;
}
**OUTPUT**
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
3)The document should have a small image of yourself, which must appear when the mouse
button is clicked at the position of the mouse cursor, regardless of the position of the cursorat
the time.
<!----move.html----->
<?xml version="1.0" encoding="utf-8" ?>
<html>
<head>
<script type="text/javascript" src="move.js">
</script>
</head>
<body onmousedown="display(event);">
<img id="myimage"
style="position:absolute; left=10; top=10;"
src="mycar.jpg"
alt="May car"
width=200 height=200 />
</body>
</html>
//move.js
function display(evt)
{
var dom=document.getElementById("myimage");
dom.style.left=evt.clientX+"px";
dom.style.top=evt.clientY+"px";
}
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
**OUTPUT**
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
4)The document must contain the statement “Save time with TIMESAVER 2.2”, which
continuously moves back and forth across the top of the display
<!----movetext.html---->
<?xml version="1.0" encoding="utf-8"?>
<html>
<body>
<script type="text/JavaScript">
mesg="save time with TIMESAVER 2.2";
isNS= (navigator.appName=="Netscape")
isIE= (navigator.appName=="Microsoft Internet Explorer")
text=("<i><font size=2>"+mesg+"</font></i>")
if(isNS){
document.write("<blink>" + text + "</blink>")}
else if(isIE){
document.write("<MARQUEE BEHAVIOR=ALTERNATE DIRECTION=RIGHT>" +text+"</MARQUEE>")}
</script>
</body>
</html>
**OUTPUT**
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
PART IIXML
5)Design an XML document to store information about patience in a hospital. Information about
patients must include name (in 3 parts, first name, middle name, last name), social security
number (SSN), age, room number, primary insurance company – including member
identification number, group number and address – secondary insurance company (in the same
sub parts as for the primary insurance company), known medical problems, and known drug
allergies. Both attributes and nested tags must be included. Make up sample data of atleast 4
patients.
<?xml version="1.0" encoding="utf-8"?>
<patients>
<patient>
<name>
<fname> Manjunath </fname>
<mname> Sangappa </mname>
<lname> Uppaladinni </lname>
</name>
<ssn> SSN12345 </ssn>
<age> 22 </age>
<room> 123 </room>
<insurance type="primary">
<id> 9945921 </id>
<gno> 413 </gno>
<address> Vijayapur </address>
</insurance>
<insurance type="secondary">
<id> 814784 </id>
<gno> 214 </gno>
<address> Bagalkot </address>
</insurance>
<medproblem> High B.P. </medproblem>
<drugallergie> Nill </drugallergie>
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
</patient>
<patient>
<name>
<fname> Anil </fname>
<mname> Bajirao </mname>
<lname> Rathod </lname>
</name>
<ssn> SSN245678 </ssn>
<age> 28 </age>
<room> 108 </room>
<insurance type="primary">
<id> 2010456 </id>
<gno> 216 </gno>
<address> Raichur </address>
</insurance>
<insurance type="secondary">
<id> 646512 </id>
<gno> 318 </gno>
<address> Belagavi </address>
</insurance>
<medproblem> Sugar </medproblem>
<drugallergie> Nill </drugallergie>
</patient>
</patients>
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
**OUTPUT**
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
6)Create a CSS style sheet for the above XML document and use it to create a display of that
document
<!--hospital.xml-->
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href='hospital.css' type='text/css'?>
<patients>
<patient>
<name>
<fname> Manjunath </fname>
<mname> Sangappa </mname>
<lname> Uppaladinni </lname>
</name>
<ssn> SSN12345 </ssn>
<age> 22 </age>
<room> 123 </room>
<insurance type="primary">
<id> 9945921 </id>
<gno> 413 </gno>
<address> Vijayapur </address>
</insurance>
<insurance type="secondary">
<id> 814784 </id>
<gno> 214 </gno>
<address> Bagalkot </address>
</insurance>
<medproblem> High B.P. </medproblem>
<drugallergie> Nill </drugallergie>
</patient>
<patient>
<name>
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
<fname> Anil </fname>
<mname> Bajirao </mname>
<lname> Rathod </lname>
</name>
<ssn> SSN245678 </ssn>
<age> 28 </age>
<room> 108 </room>
<insurance type="primary">
<id> 2010456 </id>
<gno> 216 </gno>
<address> Raichur </address>
</insurance>
<insurance type="secondary">
<id> 646512 </id>
<gno> 318 </gno>
<address> Belagavi </address>
</insurance>
<medproblem> Sugar </medproblem>
<drugallergie> Nill </drugallergie>
</patient>
</patients>
<!---hospital.css---->
patient
{
display:block;
margin-left:5%;
border:solid blue 2px
padding:4px;
}
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
name
{
color:red;
font-family:script;
font-weight:bold;
font-size:30;
margin-left:5%
}
ssn
{
display:block;
color:purple;
margin-left:5%;
font-family:Arial;
font-size:14;
}
age
{
display:block;
color:purple;
margin-left:5%;
font-family:Arial;
font-size:14;
}
room
{
display:block;
color:purple;
margin-left:5%;
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
font-family:Arial;
font-size:14;
}
insurance
{
display:block;
color:purple;
margin-left:5%;
font-family:Arial;
font-size:14;
}
medproblem
{
display:block;
color:purple;
margin-left:5%;
font-family:Arial;
font-size:14;
}
drugallergie
{
display:block;
color:purple;
margin-left:5%;
font-family:Arial;
font-size:14;
}
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
**OUTPUT**
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
7)Create XSLT style sheet for one patient element of the XML, document of exercise 5 and use it
to create a display of that element
<!--hospital.xml-->
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href='hospital.xsl' type='text/xsl'?>
<patients>
<patient>
<name>
<fname> Manjunath </fname>
<mname> Sangappa </mname>
<lname> Uppaladinni </lname>
</name>
<ssn> SSN12345 </ssn>
<age> 22 </age>
<room> 123 </room>
<insurance type="primary">
<id> 9945921 </id>
<gno> 413 </gno>
<address> Vijayapur </address>
</insurance>
<insurance type="secondary">
<id> 814784 </id>
<gno> 214 </gno>
<address> Bagalkot </address>
</insurance>
<medproblem> High B.P. </medproblem>
<drugallergie> Nill </drugallergie>
</patient>
<patient>
<name>
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
<fname> Anil </fname>
<mname> Bajirao </mname>
<lname> Rathod </lname>
</name>
<ssn> SSN245678 </ssn>
<age> 28 </age>
<room> 108 </room>
<insurance type="primary">
<id> 2010456 </id>
<gno> 216 </gno>
<address> Raichur </address>
</insurance>
<insurance type="secondary">
<id> 646512 </id>
<gno> 318 </gno>
<address> Belagavi </address>
</insurance>
<medproblem> Sugar </medproblem>
<drugallergie> Nill </drugallergie>
</patient>
</patients>
<!--hospital.xsl-->
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>Patient information</h2>
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
<table border="1">
<tr bgcolor="#9acd32">
<th>SSNO</th>
<th>Name</th>
<th>Age</th>
<th>Room</th>
</tr>
<tr>
<td><xsl:value-of select="patients/patient/ssn"/></td>
<td><xsl:value-of select="patients/patient/name"/></td>
<td><xsl:value-of select="patients/patient/age"/></td>
<td><xsl:value-of select="patients/patient/room"/></td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
**OUTPUT**
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
8)Modify the XSLT style sheet to format all the patient elements of the XML, document of
exercise 5 and use it to create a display of whole element.
<!--hospital.xml-->
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href='hospital08.xsl' type='text/xsl'?>
<patients>
<patient>
<name>
<fname> Manjunath </fname>
<mname> Sangappa </mname>
<lname> Uppaladinni </lname>
</name>
<ssn> SSN12345 </ssn>
<age> 22 </age>
<room> 123 </room>
<insurance type="primary">
<id> 9945921 </id>
<gno> 413 </gno>
<address> Vijayapur </address>
</insurance>
<insurance type="secondary">
<id> 814784 </id>
<gno> 214 </gno>
<address> Bagalkot </address>
</insurance>
<medproblem> High B.P. </medproblem>
<drugallergie> Nill </drugallergie>
</patient>
<patient>
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
<name>
<fname> Anil </fname>
<mname> Bajirao </mname>
<lname> Rathod </lname>
</name>
<ssn> SSN245678 </ssn>
<age> 28 </age>
<room> 108 </room>
<insurance type="primary">
<id> 2010456 </id>
<gno> 216 </gno>
<address> Raichur </address>
</insurance>
<insurance type="secondary">
<id> 646512 </id>
<gno> 318 </gno>
<address> Belagavi </address>
</insurance>
<medproblem> Sugar </medproblem>
<drugallergie> Nill </drugallergie>
</patient>
</patients>
<!--hospital.xsl-->
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org./TR/WD-xsl">
<xsl:template match="/">
<html>
<head>
<style>
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
</style>
</head>
<body>
<xsl:for-each select="patients/patient" order-by="ssn">
<h2>
<xsl:value-of select="ssn"/>
</h2>
<p> <strong>Name:</strong> <xsl:value-of select="name/."/> </p>
<p> <strong>Age: </strong> <xsl:value-of select="age/."/> </p>
<p> <strong>Room:</strong> <xsl:value-of select="room/."/> </p>
<p> <strong>Insurnce:</strong> <xsl:value-of select="insurance/."/> </p>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
**OUTPUT**
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
PART-III PHP
PHP- Write, test and debug PHP scripts for the following specification
9)Parameter - A string of numbers separated by spaces
Return Value – The first 4 digits number in the string; false if none.
<html>
<body>
<?php
function display($str)
{
$words=explode(" ", $str);
$n=$words[0];
$n=substr($n,0,4);
$n=(double) $n;
return $n;
}
$str="1234567 4567785 6784953 8902123";
$n=display($str);
echo $n;
?>
</body>
</html>
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
**OUTPUT**
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
10)Parameter – A file variable of a file of text where the words are separated by spaces or colons
Return value – The word that appears most common in the file.
<?php
function countfrequency($myFile)
{
$fh=fopen($myFile, 'r');
$theData=fread($fh,filesize($myFile));
$theData=eregi_replace(" +", " ", $theData);
$delim=" ";
$words=explode($delim,$theData);
$frequency=array_count_values($words);
$size=sizeof($frequency);
$keys=array_keys($frequency);
$values=array_values($frequency);
for($i=0;$i<$size;$i++)
{
print "<b>$keys[$i]:</b> $values[$i]<br/>";
}
$index=0;
$l=$values[$index];
for($i=1;$i<$size;$i++)
{
if($values[$i]>$l)
{
$l=$values[$i];
$index=$i;
}
}
return $keys[$index];
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
}
$myFile="testFile.txt";
$word=countfrequency($myFile);
echo "The word that appears most common is:<b>$word</b>";
?>
//testFile.text
BasavRaj Savalagi BMS Basavaraj Basava BasavRajSavalagi BasavRaj Basava BasavRaj Basava
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
11)Write an XHTML document to include an anchor tag, that calls a PHP document also write the
called PHP document which returns a randomly choosen greeting from a list of five different
greetings. The greetings must be stored as constant strings in the script. A random number
between 0 and 4 can be computed with these line.
#set the seed for mtrand with the number of microseconds
#since the last full second of the clock
mt_strand((double) microtime() * 1000000);
$number=mtrand(0,4); #computes a random integer0-4
<!--greeting.html-->
<?xml version="1.0" encoding="utf-8" ?>
<html>
<head>
<title>Preferred Greeting page</title>
</head>
<body>
Do you prefer a formal greeting or an informal greeting?
<a href="greeting.php">Display greeting</a>
</body>
</html>
<!--greeting.php-->
<?php
$greeting=array();
$greeting[0]="Hello ,how are you Mr BasavRaj?";
$greeting[1]="Hi how are you today?";
$greeting[2]="Welcome to the my php page world";
$greeting[3]="Good morning every one";
$greeting[4]="Good evening and Good nigth";
$n=mt_rand(0,4);
echo $greeting[$n];
?>
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
**OUTPUT**
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
11) Write the XHTML code to create the form with the following capabilities
a) A text widget to collect the users name
b) Four check boxes, one each for the following items
i) Four 100 watt light bulbs for Rs. 20=39
ii) Eight 100 watt light bulbs for Rs 40=20
iii) Four 100 watt long life light bulbs for Rs. 30=95
iv) Eight 100 watt long life light bulbs for Rs 70=49
c) A collection of 3 radio buttons that are labeled as follows
i) Visa
ii) Master Card
iii) Discover
<--orderfron.html-->
<?xml version="1.0" encoding="utf-8"?>
<html>
<head>
<title> Order from </title>
</head>
<body>
<form action="">
User name=<input type="text" name="myname" size="30"/> <br/>
select the items: <br/>
<input type="checkbox" name="b[]" value="20.39" checked="checked"/> four 100 watt light <br/>
<input type="checkbox" name="b[]" value="40.20" checked="checked"/> eight 100 watt light <br/>
<input type="checkbox" name="b[]" value="30.39" checked="checked"/> four 100 watt long life
light <br/>
<input type="checkbox" name="b[]" value="70.39" checked="checked"/> eight 100 watt long life
light <br/>
select the mode of the payment:<br/>
<input type="radio" name="paymode" value="visa" checked="checked" />Visa <br/>
<input type="radio" name="paymode" value="Master card" /> Master card <br/>
<input type="radio" name="paymode" value="discover"/> Discover <br/>
<input type="submit" value="Submit Order"/>
<input type="reset" value="Clear the form" />
</form>
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
</body>
</html>
**OUTPUT**
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
13)Write a PHP script that computes the total cost of the ordered light bulbs from the exercise
12 after adding 13.5% VAT. The program must inform the buyer of exactly what was ordered
in table.
<--orderfrom.html-->
<?xml version="1.0" encoding="utf-8"?>
<html>
<head>
<title> Order from </title>
</head>
<body>
<form method="POST" action="calculate.php">
User name=<input type="text" name="myname" size="30"/> <br/>
select the items: <br/>
<input type="checkbox" name="b[]" value="20.39" checked="checked"/> four 100 watt light <br/>
<input type="checkbox" name="b[]" value="40.20" checked="checked"/> eight 100 watt light <br/>
<input type="checkbox" name="b[]" value="30.39" checked="checked"/> four 100 watt long life light
<br/>
<input type="checkbox" name="b[]" value="70.39" checked="checked"/> eight 100 watt long life
light <br/>
select the mode of the payment:<br/>
<input type="radio" name="paymode" value="Visa" checked="checked" />Visa <br/>
<input type="radio" name="paymode" value="Master card" /> Master card <br/>
<input type="radio" name="paymode" value="Discover"/> Discover <br/>
<input type="submit" value="Submit Order"/>
<input type="reset" value="Clear the form" />
</form>
</body>
</html>
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
<!--orderfrom.php-->
<?php
$name=$_POST["myname"];
$bulbs=$_POST["b"];
$pmode=$_POST["paymode"];
print "your name is: $name<br/>";
$total=0;
for($i=0; $i<sizeof($bulbs); $i++)
{
$vat=$bulbs[$i]*0.135;
$total=$total+$bulbs[$i]+$vat;
}
print "the total cost: $total<br/>";
print "your payment mode is by : $pmode";
?>
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
**OUTPUT**
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
14) Write a XHTML code to create a form that collects favorite popularsongs, including the name
of the song, the composer and the performing artist or group. This document must call one PHP
script when the form is submitted and another torequest a current list of survey results
<!--Songform.html-->
<?xml version="1.0" encoding="utf-8"?>
<html>
<head>
<title> Song form </title>
</head>
<body>
<form method="post" action="processform.php">
Song name: <input type="text" name="sname" size="30" /> <br/>
Composer: <input type="text" name="cname" size="20"/> <br/>
Artists: <br/>
<input type="checkbox" name="artist[]" value="Flute Man" checked="checked"/> Flute
Man<br/>
<input type="checkbox" name="artist[]" value="Tabala Man" /> Tabala Man<br/>
<input type="checkbox" name="artist[]" value="Violin Man" /> Violin Man <br/>
<input type="checkbox" name="artist[]" value="support singers" /> Support Singers <br/>
<input type="submit" value="submit form" />
<input type="reset" value="clear form" />
</form>
</body>
</html>
<!--Processform.php-->
<?php
$songname=$_POST["sname"];
$compname=$_POST["cname"];
$artists=$_POST["artist"];
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
print "song name is: $songname <br/> ";
print "composer is: $compname <br/>" ;
print "artists: <br/>";
for($i=0; $i<sizeof($artists); $i++)
{
print "$artists[$i] <br/>";
}
?>
**OUTPUT**
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
15)Write a XHTML code to provide a form that collects names and telephone numbers. The
phone numbers must be in the format ddd-ddd-dddd. Write a PHP script that checks the
submitted telephone number to be sure that it confirms to the required format and then
returns a response that indicates whether the number was correct.
<!--Phoneform.html-->
<?xml version="1.0" encoding="utf-8"?>
<html>
<head>
</head>
<body>
<form method="post" action="validate.php">
Name:<input type="text" name="uname" size="30"/> <br/>
Telephone Number:<input type="text" name="phone" size="20"/> <br/>
<input type="submit" value="Submit Form"/>
<input type="reset" value="clear form"/>
</form>
</body>
</html>
<!--validate.php-->
<?php
$name=$_POST["uname"];
$phon=$_POST["phone"];
if(ereg("([0-9]{3})-([0-9]{3})-([0-9]{4})", $phon))
{
print "phone number entered is correct";
}
else
{
print "phone number entered is incorrect";
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
}
?>
**OUTPUT**
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
16)Modify the PHP script of exercise 11 to count the numberof visitors and display that number
for each visitor
Hint: Use a file to store current count.
<!--countvisitors.php-->
<?php
$count = file_get_contents("count.txt");
$count = explode("=", $count);
$count[1] =$count[1]+1;
$file = fopen("count.txt", "w+");
fwrite($file, "count=".$count[1]);
fclose($file);
print "Total number of visitors=".$count[1];
?>
**OUTPUT**
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
17) Accept from the user name, phone no , mail-ed ,store in database . retrieve same information
from database using a separate PHP script
<!-- `addressbook`.`book` -->
<?xml version="1.0" encoding="utf-8"?>
<html>
<body>
<form action="insert.php" method="post">
Name: <input type="text" name="uname" /> <br/>
Phone: <input type="text" name="uphone" /> <br/>
Email: <input type="text" name="email"/> <br/>
<input type="Submit" value="Submit form"/>
<input type="reset" value="Reset Form"/>
</form>
</body>
</html>
//insert.php
<?php
$username="root";
$password="";
$server="localhost";
$database="address_book1";
$name=$_POST['uname'];
$phone=$_POST['uphone'];
$email=$_POST['email'];
mysql_connect($server,$username,$password);
mysql_select_db($database);
$query = "INSERT INTO address_book1 VALUES('$name','$phone','$email')";
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
mysql_query($query);
$query = "SELECT * FROM address_book1";
$sql_query = mysql_query($query);
$row=mysql_fetch_array($sql_query);
while ($row = mysql_fetch_array($sql_query))
{
echo $row["name"]."<br/>";
echo $row["phone"]."<br/>";
echo $row["email"]."";
echo "";
}
mysql_close();
?>
Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
**OUTPUT**

More Related Content

What's hot

Internet programming lab manual
Internet programming lab manualInternet programming lab manual
Internet programming lab manualinteldualcore
 
Web Technology Lab File
Web Technology Lab FileWeb Technology Lab File
Web Technology Lab FileKandarp Tiwari
 
Template-based Modular Architecture
Template-based Modular ArchitectureTemplate-based Modular Architecture
Template-based Modular Architecturegenify
 
XML Business Rules Validation with Schematron
XML Business Rules Validation with SchematronXML Business Rules Validation with Schematron
XML Business Rules Validation with SchematronEmiel Paasschens
 
Web app development_html_02
Web app development_html_02Web app development_html_02
Web app development_html_02Hassen Poreya
 
Лабораторная работа №1
Лабораторная работа №1Лабораторная работа №1
Лабораторная работа №1Alexey Potopakhin
 
Javascript basic programs
Javascript basic programsJavascript basic programs
Javascript basic programsDigital Shende
 
Rapid HTML Prototyping with Bootstrap - Chris Griffith
Rapid HTML Prototyping with Bootstrap - Chris GriffithRapid HTML Prototyping with Bootstrap - Chris Griffith
Rapid HTML Prototyping with Bootstrap - Chris GriffithUXPA International
 

What's hot (16)

Internet programming lab manual
Internet programming lab manualInternet programming lab manual
Internet programming lab manual
 
Delete statement in PHP
Delete statement in PHPDelete statement in PHP
Delete statement in PHP
 
Web technology lab manual
Web technology lab manualWeb technology lab manual
Web technology lab manual
 
Web Technology Lab File
Web Technology Lab FileWeb Technology Lab File
Web Technology Lab File
 
Update statement in PHP
Update statement in PHPUpdate statement in PHP
Update statement in PHP
 
Template-based Modular Architecture
Template-based Modular ArchitectureTemplate-based Modular Architecture
Template-based Modular Architecture
 
Sessionex1
Sessionex1Sessionex1
Sessionex1
 
XML Business Rules Validation with Schematron
XML Business Rules Validation with SchematronXML Business Rules Validation with Schematron
XML Business Rules Validation with Schematron
 
Rog rog. html
Rog rog. htmlRog rog. html
Rog rog. html
 
Form
FormForm
Form
 
Web app development_html_02
Web app development_html_02Web app development_html_02
Web app development_html_02
 
Лабораторная работа №1
Лабораторная работа №1Лабораторная работа №1
Лабораторная работа №1
 
Database connectivity in PHP
Database connectivity in PHPDatabase connectivity in PHP
Database connectivity in PHP
 
Javascript basic programs
Javascript basic programsJavascript basic programs
Javascript basic programs
 
Rapid HTML Prototyping with Bootstrap - Chris Griffith
Rapid HTML Prototyping with Bootstrap - Chris GriffithRapid HTML Prototyping with Bootstrap - Chris Griffith
Rapid HTML Prototyping with Bootstrap - Chris Griffith
 
Profit statement 00
Profit statement 00Profit statement 00
Profit statement 00
 

Viewers also liked

7 Traps in Dentistry
7 Traps in Dentistry7 Traps in Dentistry
7 Traps in DentistryScott Cairns
 
Beatz McGee Bio Final
Beatz McGee Bio FinalBeatz McGee Bio Final
Beatz McGee Bio FinalJhenet Tait
 
Medios de difusión de datos presentacion
Medios de difusión de datos presentacionMedios de difusión de datos presentacion
Medios de difusión de datos presentacionIreneecondee
 
El español es fácil
El español es fácilEl español es fácil
El español es fácilcineavenida
 
Diario Resumen 20161103
Diario Resumen 20161103Diario Resumen 20161103
Diario Resumen 20161103Diario Resumen
 
презентація "реальні інвестиції"
презентація "реальні інвестиції"презентація "реальні інвестиції"
презентація "реальні інвестиції"Alena2016
 
WriteyBoard Sales Catalog 2016
WriteyBoard Sales Catalog 2016WriteyBoard Sales Catalog 2016
WriteyBoard Sales Catalog 2016Christian Tomelius
 
Concept of National Income with GDP GNP NNP& NDP
Concept of National Income with GDP GNP NNP& NDPConcept of National Income with GDP GNP NNP& NDP
Concept of National Income with GDP GNP NNP& NDPAnkit Singh
 
Mobile App Marketing Trends & Strategies for Asia - ARPU, App Store Rank Data...
Mobile App Marketing Trends & Strategies for Asia - ARPU, App Store Rank Data...Mobile App Marketing Trends & Strategies for Asia - ARPU, App Store Rank Data...
Mobile App Marketing Trends & Strategies for Asia - ARPU, App Store Rank Data...appsasia
 

Viewers also liked (14)

7 Traps in Dentistry
7 Traps in Dentistry7 Traps in Dentistry
7 Traps in Dentistry
 
ADA 8
ADA 8ADA 8
ADA 8
 
Beatz McGee Bio Final
Beatz McGee Bio FinalBeatz McGee Bio Final
Beatz McGee Bio Final
 
MBA - Managing Beyond Academics
MBA - Managing Beyond AcademicsMBA - Managing Beyond Academics
MBA - Managing Beyond Academics
 
Medios de difusión de datos presentacion
Medios de difusión de datos presentacionMedios de difusión de datos presentacion
Medios de difusión de datos presentacion
 
El español es fácil
El español es fácilEl español es fácil
El español es fácil
 
ROLEC Web Final
ROLEC Web FinalROLEC Web Final
ROLEC Web Final
 
Diario Resumen 20161103
Diario Resumen 20161103Diario Resumen 20161103
Diario Resumen 20161103
 
Conference Slides
Conference SlidesConference Slides
Conference Slides
 
Documentación docente
Documentación docenteDocumentación docente
Documentación docente
 
презентація "реальні інвестиції"
презентація "реальні інвестиції"презентація "реальні інвестиції"
презентація "реальні інвестиції"
 
WriteyBoard Sales Catalog 2016
WriteyBoard Sales Catalog 2016WriteyBoard Sales Catalog 2016
WriteyBoard Sales Catalog 2016
 
Concept of National Income with GDP GNP NNP& NDP
Concept of National Income with GDP GNP NNP& NDPConcept of National Income with GDP GNP NNP& NDP
Concept of National Income with GDP GNP NNP& NDP
 
Mobile App Marketing Trends & Strategies for Asia - ARPU, App Store Rank Data...
Mobile App Marketing Trends & Strategies for Asia - ARPU, App Store Rank Data...Mobile App Marketing Trends & Strategies for Asia - ARPU, App Store Rank Data...
Mobile App Marketing Trends & Strategies for Asia - ARPU, App Store Rank Data...
 

Similar to Web programming

Cancer de-prostata-40601330[1]
Cancer de-prostata-40601330[1]Cancer de-prostata-40601330[1]
Cancer de-prostata-40601330[1]Ludwing007
 
Ilmu sosial dasar - Pembuatan CV - HTML
Ilmu sosial dasar - Pembuatan CV  - HTMLIlmu sosial dasar - Pembuatan CV  - HTML
Ilmu sosial dasar - Pembuatan CV - HTMLIgnatiusAdityaKurnia
 
网站无障碍阅读知识
网站无障碍阅读知识网站无障碍阅读知识
网站无障碍阅读知识ppanyong
 
Rails, Postgres, Angular, and Bootstrap: The Power Stack
Rails, Postgres, Angular, and Bootstrap: The Power StackRails, Postgres, Angular, and Bootstrap: The Power Stack
Rails, Postgres, Angular, and Bootstrap: The Power StackDavid Copeland
 
Los Estados De La Materia
Los Estados De La MateriaLos Estados De La Materia
Los Estados De La MateriaMayritalinda
 
Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...
Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...
Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...Mario Heiderich
 
krish (1).pdf
krish (1).pdfkrish (1).pdf
krish (1).pdfKrish11A
 
2001: Bridging the Gap between RSS and Java Old School Style
2001: Bridging the Gap between RSS and Java Old School Style2001: Bridging the Gap between RSS and Java Old School Style
2001: Bridging the Gap between RSS and Java Old School StyleRussell Castagnaro
 
Internet and Web Technology (CLASS-8) [jQuery and JSON] | NIC/NIELIT Web Tech...
Internet and Web Technology (CLASS-8) [jQuery and JSON] | NIC/NIELIT Web Tech...Internet and Web Technology (CLASS-8) [jQuery and JSON] | NIC/NIELIT Web Tech...
Internet and Web Technology (CLASS-8) [jQuery and JSON] | NIC/NIELIT Web Tech...Ayes Chinmay
 
2. CSS Chapter Roadmap and Full Source Code.pdf
2. CSS Chapter Roadmap and Full Source Code.pdf2. CSS Chapter Roadmap and Full Source Code.pdf
2. CSS Chapter Roadmap and Full Source Code.pdfBdBangladesh
 
El Tiempo Nos Ensea 214392
El Tiempo Nos Ensea 214392El Tiempo Nos Ensea 214392
El Tiempo Nos Ensea 214392guestc65f09
 
FYBSC IT Web Programming Unit III Javascript
FYBSC IT Web Programming Unit III JavascriptFYBSC IT Web Programming Unit III Javascript
FYBSC IT Web Programming Unit III JavascriptArti Parab Academics
 

Similar to Web programming (20)

Html5 intro
Html5 introHtml5 intro
Html5 intro
 
Cancer de-prostata-40601330[1]
Cancer de-prostata-40601330[1]Cancer de-prostata-40601330[1]
Cancer de-prostata-40601330[1]
 
Ilmu sosial dasar - Pembuatan CV - HTML
Ilmu sosial dasar - Pembuatan CV  - HTMLIlmu sosial dasar - Pembuatan CV  - HTML
Ilmu sosial dasar - Pembuatan CV - HTML
 
网站无障碍阅读知识
网站无障碍阅读知识网站无障碍阅读知识
网站无障碍阅读知识
 
Broadleaf Presents Thymeleaf
Broadleaf Presents ThymeleafBroadleaf Presents Thymeleaf
Broadleaf Presents Thymeleaf
 
Rails, Postgres, Angular, and Bootstrap: The Power Stack
Rails, Postgres, Angular, and Bootstrap: The Power StackRails, Postgres, Angular, and Bootstrap: The Power Stack
Rails, Postgres, Angular, and Bootstrap: The Power Stack
 
Los Estados De La Materia
Los Estados De La MateriaLos Estados De La Materia
Los Estados De La Materia
 
Practica n° 7
Practica n° 7Practica n° 7
Practica n° 7
 
Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...
Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...
Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...
 
krish (1).pdf
krish (1).pdfkrish (1).pdf
krish (1).pdf
 
2001: Bridging the Gap between RSS and Java Old School Style
2001: Bridging the Gap between RSS and Java Old School Style2001: Bridging the Gap between RSS and Java Old School Style
2001: Bridging the Gap between RSS and Java Old School Style
 
Tercer trabajo de drapi 02
Tercer trabajo de drapi 02Tercer trabajo de drapi 02
Tercer trabajo de drapi 02
 
Wt unit 2 ppts client sied technology
Wt unit 2 ppts client sied technologyWt unit 2 ppts client sied technology
Wt unit 2 ppts client sied technology
 
Wt unit 2 ppts client side technology
Wt unit 2 ppts client side technologyWt unit 2 ppts client side technology
Wt unit 2 ppts client side technology
 
Internet and Web Technology (CLASS-8) [jQuery and JSON] | NIC/NIELIT Web Tech...
Internet and Web Technology (CLASS-8) [jQuery and JSON] | NIC/NIELIT Web Tech...Internet and Web Technology (CLASS-8) [jQuery and JSON] | NIC/NIELIT Web Tech...
Internet and Web Technology (CLASS-8) [jQuery and JSON] | NIC/NIELIT Web Tech...
 
2. CSS Chapter Roadmap and Full Source Code.pdf
2. CSS Chapter Roadmap and Full Source Code.pdf2. CSS Chapter Roadmap and Full Source Code.pdf
2. CSS Chapter Roadmap and Full Source Code.pdf
 
El Tiempo Nos Ensea 214392
El Tiempo Nos Ensea 214392El Tiempo Nos Ensea 214392
El Tiempo Nos Ensea 214392
 
course js day 3
course js day 3course js day 3
course js day 3
 
FYBSC IT Web Programming Unit III Javascript
FYBSC IT Web Programming Unit III JavascriptFYBSC IT Web Programming Unit III Javascript
FYBSC IT Web Programming Unit III Javascript
 
Fcr 2
Fcr 2Fcr 2
Fcr 2
 

Recently uploaded

OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...NETWAYS
 
George Lever - eCommerce Day Chile 2024
George Lever -  eCommerce Day Chile 2024George Lever -  eCommerce Day Chile 2024
George Lever - eCommerce Day Chile 2024eCommerce Institute
 
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...
OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...
OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...NETWAYS
 
Genesis part 2 Isaiah Scudder 04-24-2024.pptx
Genesis part 2 Isaiah Scudder 04-24-2024.pptxGenesis part 2 Isaiah Scudder 04-24-2024.pptx
Genesis part 2 Isaiah Scudder 04-24-2024.pptxFamilyWorshipCenterD
 
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...Kayode Fayemi
 
The 3rd Intl. Workshop on NL-based Software Engineering
The 3rd Intl. Workshop on NL-based Software EngineeringThe 3rd Intl. Workshop on NL-based Software Engineering
The 3rd Intl. Workshop on NL-based Software EngineeringSebastiano Panichella
 
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdf
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdfOpen Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdf
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdfhenrik385807
 
call girls in delhi malviya nagar @9811711561@
call girls in delhi malviya nagar @9811711561@call girls in delhi malviya nagar @9811711561@
call girls in delhi malviya nagar @9811711561@vikas rana
 
Open Source Camp Kubernetes 2024 | Monitoring Kubernetes With Icinga by Eric ...
Open Source Camp Kubernetes 2024 | Monitoring Kubernetes With Icinga by Eric ...Open Source Camp Kubernetes 2024 | Monitoring Kubernetes With Icinga by Eric ...
Open Source Camp Kubernetes 2024 | Monitoring Kubernetes With Icinga by Eric ...NETWAYS
 
Night 7k Call Girls Noida Sector 128 Call Me: 8448380779
Night 7k Call Girls Noida Sector 128 Call Me: 8448380779Night 7k Call Girls Noida Sector 128 Call Me: 8448380779
Night 7k Call Girls Noida Sector 128 Call Me: 8448380779Delhi Call girls
 
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...Pooja Nehwal
 
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )Pooja Nehwal
 
SBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation TrackSBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation TrackSebastiano Panichella
 
OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...
OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...
OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...NETWAYS
 
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with AerialistSimulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with AerialistSebastiano Panichella
 
Work Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptxWork Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptxmavinoikein
 
NATIONAL ANTHEMS OF AFRICA (National Anthems of Africa)
NATIONAL ANTHEMS OF AFRICA (National Anthems of Africa)NATIONAL ANTHEMS OF AFRICA (National Anthems of Africa)
NATIONAL ANTHEMS OF AFRICA (National Anthems of Africa)Basil Achie
 
Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024
Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024
Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024eCommerce Institute
 
Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝soniya singh
 

Recently uploaded (20)

OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...
OSCamp Kubernetes 2024 | A Tester's Guide to CI_CD as an Automated Quality Co...
 
George Lever - eCommerce Day Chile 2024
George Lever -  eCommerce Day Chile 2024George Lever -  eCommerce Day Chile 2024
George Lever - eCommerce Day Chile 2024
 
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝
 
OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...
OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...
OSCamp Kubernetes 2024 | Zero-Touch OS-Infrastruktur für Container und Kubern...
 
Genesis part 2 Isaiah Scudder 04-24-2024.pptx
Genesis part 2 Isaiah Scudder 04-24-2024.pptxGenesis part 2 Isaiah Scudder 04-24-2024.pptx
Genesis part 2 Isaiah Scudder 04-24-2024.pptx
 
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...
Governance and Nation-Building in Nigeria: Some Reflections on Options for Po...
 
The 3rd Intl. Workshop on NL-based Software Engineering
The 3rd Intl. Workshop on NL-based Software EngineeringThe 3rd Intl. Workshop on NL-based Software Engineering
The 3rd Intl. Workshop on NL-based Software Engineering
 
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdf
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdfOpen Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdf
Open Source Strategy in Logistics 2015_Henrik Hankedvz-d-nl-log-conference.pdf
 
call girls in delhi malviya nagar @9811711561@
call girls in delhi malviya nagar @9811711561@call girls in delhi malviya nagar @9811711561@
call girls in delhi malviya nagar @9811711561@
 
Open Source Camp Kubernetes 2024 | Monitoring Kubernetes With Icinga by Eric ...
Open Source Camp Kubernetes 2024 | Monitoring Kubernetes With Icinga by Eric ...Open Source Camp Kubernetes 2024 | Monitoring Kubernetes With Icinga by Eric ...
Open Source Camp Kubernetes 2024 | Monitoring Kubernetes With Icinga by Eric ...
 
Night 7k Call Girls Noida Sector 128 Call Me: 8448380779
Night 7k Call Girls Noida Sector 128 Call Me: 8448380779Night 7k Call Girls Noida Sector 128 Call Me: 8448380779
Night 7k Call Girls Noida Sector 128 Call Me: 8448380779
 
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
Navi Mumbai Call Girls Service Pooja 9892124323 Real Russian Girls Looking Mo...
 
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )
WhatsApp 📞 9892124323 ✅Call Girls In Juhu ( Mumbai )
 
SBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation TrackSBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation Track
 
OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...
OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...
OSCamp Kubernetes 2024 | SRE Challenges in Monolith to Microservices Shift at...
 
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with AerialistSimulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
 
Work Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptxWork Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptx
 
NATIONAL ANTHEMS OF AFRICA (National Anthems of Africa)
NATIONAL ANTHEMS OF AFRICA (National Anthems of Africa)NATIONAL ANTHEMS OF AFRICA (National Anthems of Africa)
NATIONAL ANTHEMS OF AFRICA (National Anthems of Africa)
 
Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024
Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024
Andrés Ramírez Gossler, Facundo Schinnea - eCommerce Day Chile 2024
 
Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝
Call Girls in Sarojini Nagar Market Delhi 💯 Call Us 🔝8264348440🔝
 

Web programming

  • 1. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. 1)The document must have a paragraph of text that describes yourhome. Choose at least three different phrases (3 to 6 words) of this paragraph and make them change font, font style, color and font size when the mouse cursor is placed over them. Each of the different phrases must change to different fonts, font styles, colors and font sizes. <!-------changecolorfont------> <?xml version="1.0" encoding="utf-8"?> <html> <head> <title>Dynaamic fonts for link</title> <style type="text/css"> .regText{font:Times;font-size:14pt;} </style> </head> <body> <p clss="regText"> My Home Name Is <b style="color:blue;" onmouseover="this.style.color='red'; this.style.font='italic 16pt Tahoma';" onmouseout="this.style.color='blue'; this.style.font='normal 16pt Times';"> Basava Krupa </b>.It is lacated nearby Govt polytechnic college, In Basav nagar, <b style="color:blue;" onmouseover="this.style.color='orange'; this.style.font='bold 16pt Arial';" onmouseout="this.style.color='blue'; this.style.font='normal 16pt Times';"> Bijapur
  • 2. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. </b>.My house is facing Towards <b style="color:pink;" onmouseover="this.style.color='red'; this.style.font='italic 16pt Tahoma';" onmouseout="this.style.color='blue'; this.style.font='normal 16pt Times';"> East </b>.It is double bed home.there is a 16 foot road in front of the home. There is a sufficient place for <b style="color:brown;" onmouseover="this.style.color='yellow'; this.style.font='italic 16pt Tahoma';" onmouseout="this.style.color='blue'; this.style.font='normal 16pt Times';"> gardening </b>.and car motor cycle parking,it is built in the <u style="color:gray;" onmouseover="this.style.color='brown'; this.style.font='italic 16pt Tahoma';" onmouseout="this.style.color='blue'; this.style.font='normal 16pt Times';"> Area 45x40 squire foot </u>. </p> </body> </html>
  • 3. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. **OUTPUT**
  • 4. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. 2)The document must contain fourshort paragraphs of text stacked on top of each other with only enough of each showing so that the mouse cursor can also be placed oversome part of them. When the cursor is placed over the exposed part of any paragraph it should raise to the top to become completely visible. <!----Stcking.html----> <?xml version="1.0" encoding="utf-8"?> <html> <head> <title>Dynamic stackin Paragraph</title> <script type="text/javascript" src="stacking.js"> </script> <style type="text/css"> .para1 {color:red;position:absolute; top: 10px; left: 10px; z-index: 0;background-color:yellow} .para2 {color:green;position:absolute; top: 30px; left: 100px; z-index: 0;background-color:gray} .para3 {color:black;position:absolute; top: 50px; left: 200px; z-index: 0;background-color:white} .para4 {color:brown;position:absolute; top: 70px; left: 300px; z-index: 0;background-color:pink} </style> </head> <body> <p class="para1" id='p1' onmouseover="toTop('p1');"> A dynamic Xhtml document,which can be modifiedeither while it is being displayed or after it has been displayed. more Specifically,A dynamic xhtml is one whose tag attributes, tag contents are elements stylemore Specifically,A dynamic xhtml is one whose tag attributes, tag contents are elements style
  • 5. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. properties can changed after the documents has been displayed or while is being displayed. </p> <p class="para2" id='p2' onmouseover="toTop('p2');"> The default layout of XHTML elements in the documents is from left to right in the way text is placed in any text editor . when the row is filled ,laying out The default layout of XHTML elements in the documents is from left to right in the way text is placed in any text editor . when the row is filled ,laying out </p> <p class="para3" id='p3' onmouseover="toTop('p3');"> A dynamic Xhtml document,which can be modifiedeither while it is being displayed or after it has been displayed. more Specifically,A dynamic xhtml is one whose tag attributes, tag contents are elements style properties can changed after the documents has been displayedor while is being displayed. </p> <p class="para4" id='p4' onmouseover="toTop('p4');"> A dynamic Xhtml document,which can be modifiedeither while it is being displayed or after it has been displayed. more Specifically,A dynamic xhtml is one whose tag attributes, tag contents are elements style properties can changed after the documents has been displayedor while is being displayed. </p> </body> </html>//stacking.js var oldTop="p1"; function toTop(newTop)
  • 6. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. { domTop = document.getElementById(oldTop).style; domNew = document.getElementById(newTop).style; domTop.zIndex = "0"; domNew.zIndex = "10"; oldTop = newTop; } **OUTPUT**
  • 7. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
  • 8. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. 3)The document should have a small image of yourself, which must appear when the mouse button is clicked at the position of the mouse cursor, regardless of the position of the cursorat the time. <!----move.html-----> <?xml version="1.0" encoding="utf-8" ?> <html> <head> <script type="text/javascript" src="move.js"> </script> </head> <body onmousedown="display(event);"> <img id="myimage" style="position:absolute; left=10; top=10;" src="mycar.jpg" alt="May car" width=200 height=200 /> </body> </html> //move.js function display(evt) { var dom=document.getElementById("myimage"); dom.style.left=evt.clientX+"px"; dom.style.top=evt.clientY+"px"; }
  • 9. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. **OUTPUT**
  • 10. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. 4)The document must contain the statement “Save time with TIMESAVER 2.2”, which continuously moves back and forth across the top of the display <!----movetext.html----> <?xml version="1.0" encoding="utf-8"?> <html> <body> <script type="text/JavaScript"> mesg="save time with TIMESAVER 2.2"; isNS= (navigator.appName=="Netscape") isIE= (navigator.appName=="Microsoft Internet Explorer") text=("<i><font size=2>"+mesg+"</font></i>") if(isNS){ document.write("<blink>" + text + "</blink>")} else if(isIE){ document.write("<MARQUEE BEHAVIOR=ALTERNATE DIRECTION=RIGHT>" +text+"</MARQUEE>")} </script> </body> </html> **OUTPUT**
  • 11. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
  • 12. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. PART IIXML 5)Design an XML document to store information about patience in a hospital. Information about patients must include name (in 3 parts, first name, middle name, last name), social security number (SSN), age, room number, primary insurance company – including member identification number, group number and address – secondary insurance company (in the same sub parts as for the primary insurance company), known medical problems, and known drug allergies. Both attributes and nested tags must be included. Make up sample data of atleast 4 patients. <?xml version="1.0" encoding="utf-8"?> <patients> <patient> <name> <fname> Manjunath </fname> <mname> Sangappa </mname> <lname> Uppaladinni </lname> </name> <ssn> SSN12345 </ssn> <age> 22 </age> <room> 123 </room> <insurance type="primary"> <id> 9945921 </id> <gno> 413 </gno> <address> Vijayapur </address> </insurance> <insurance type="secondary"> <id> 814784 </id> <gno> 214 </gno> <address> Bagalkot </address> </insurance> <medproblem> High B.P. </medproblem> <drugallergie> Nill </drugallergie>
  • 13. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. </patient> <patient> <name> <fname> Anil </fname> <mname> Bajirao </mname> <lname> Rathod </lname> </name> <ssn> SSN245678 </ssn> <age> 28 </age> <room> 108 </room> <insurance type="primary"> <id> 2010456 </id> <gno> 216 </gno> <address> Raichur </address> </insurance> <insurance type="secondary"> <id> 646512 </id> <gno> 318 </gno> <address> Belagavi </address> </insurance> <medproblem> Sugar </medproblem> <drugallergie> Nill </drugallergie> </patient> </patients>
  • 14. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. **OUTPUT**
  • 15. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. 6)Create a CSS style sheet for the above XML document and use it to create a display of that document <!--hospital.xml--> <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet href='hospital.css' type='text/css'?> <patients> <patient> <name> <fname> Manjunath </fname> <mname> Sangappa </mname> <lname> Uppaladinni </lname> </name> <ssn> SSN12345 </ssn> <age> 22 </age> <room> 123 </room> <insurance type="primary"> <id> 9945921 </id> <gno> 413 </gno> <address> Vijayapur </address> </insurance> <insurance type="secondary"> <id> 814784 </id> <gno> 214 </gno> <address> Bagalkot </address> </insurance> <medproblem> High B.P. </medproblem> <drugallergie> Nill </drugallergie> </patient> <patient> <name>
  • 16. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. <fname> Anil </fname> <mname> Bajirao </mname> <lname> Rathod </lname> </name> <ssn> SSN245678 </ssn> <age> 28 </age> <room> 108 </room> <insurance type="primary"> <id> 2010456 </id> <gno> 216 </gno> <address> Raichur </address> </insurance> <insurance type="secondary"> <id> 646512 </id> <gno> 318 </gno> <address> Belagavi </address> </insurance> <medproblem> Sugar </medproblem> <drugallergie> Nill </drugallergie> </patient> </patients> <!---hospital.css----> patient { display:block; margin-left:5%; border:solid blue 2px padding:4px; }
  • 17. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. name { color:red; font-family:script; font-weight:bold; font-size:30; margin-left:5% } ssn { display:block; color:purple; margin-left:5%; font-family:Arial; font-size:14; } age { display:block; color:purple; margin-left:5%; font-family:Arial; font-size:14; } room { display:block; color:purple; margin-left:5%;
  • 18. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. font-family:Arial; font-size:14; } insurance { display:block; color:purple; margin-left:5%; font-family:Arial; font-size:14; } medproblem { display:block; color:purple; margin-left:5%; font-family:Arial; font-size:14; } drugallergie { display:block; color:purple; margin-left:5%; font-family:Arial; font-size:14; }
  • 19. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. **OUTPUT**
  • 20. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. 7)Create XSLT style sheet for one patient element of the XML, document of exercise 5 and use it to create a display of that element <!--hospital.xml--> <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href='hospital.xsl' type='text/xsl'?> <patients> <patient> <name> <fname> Manjunath </fname> <mname> Sangappa </mname> <lname> Uppaladinni </lname> </name> <ssn> SSN12345 </ssn> <age> 22 </age> <room> 123 </room> <insurance type="primary"> <id> 9945921 </id> <gno> 413 </gno> <address> Vijayapur </address> </insurance> <insurance type="secondary"> <id> 814784 </id> <gno> 214 </gno> <address> Bagalkot </address> </insurance> <medproblem> High B.P. </medproblem> <drugallergie> Nill </drugallergie> </patient> <patient> <name>
  • 21. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. <fname> Anil </fname> <mname> Bajirao </mname> <lname> Rathod </lname> </name> <ssn> SSN245678 </ssn> <age> 28 </age> <room> 108 </room> <insurance type="primary"> <id> 2010456 </id> <gno> 216 </gno> <address> Raichur </address> </insurance> <insurance type="secondary"> <id> 646512 </id> <gno> 318 </gno> <address> Belagavi </address> </insurance> <medproblem> Sugar </medproblem> <drugallergie> Nill </drugallergie> </patient> </patients> <!--hospital.xsl--> <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <h2>Patient information</h2>
  • 22. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. <table border="1"> <tr bgcolor="#9acd32"> <th>SSNO</th> <th>Name</th> <th>Age</th> <th>Room</th> </tr> <tr> <td><xsl:value-of select="patients/patient/ssn"/></td> <td><xsl:value-of select="patients/patient/name"/></td> <td><xsl:value-of select="patients/patient/age"/></td> <td><xsl:value-of select="patients/patient/room"/></td> </tr> </table> </body> </html> </xsl:template> </xsl:stylesheet>
  • 23. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. **OUTPUT**
  • 24. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. 8)Modify the XSLT style sheet to format all the patient elements of the XML, document of exercise 5 and use it to create a display of whole element. <!--hospital.xml--> <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href='hospital08.xsl' type='text/xsl'?> <patients> <patient> <name> <fname> Manjunath </fname> <mname> Sangappa </mname> <lname> Uppaladinni </lname> </name> <ssn> SSN12345 </ssn> <age> 22 </age> <room> 123 </room> <insurance type="primary"> <id> 9945921 </id> <gno> 413 </gno> <address> Vijayapur </address> </insurance> <insurance type="secondary"> <id> 814784 </id> <gno> 214 </gno> <address> Bagalkot </address> </insurance> <medproblem> High B.P. </medproblem> <drugallergie> Nill </drugallergie> </patient> <patient>
  • 25. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. <name> <fname> Anil </fname> <mname> Bajirao </mname> <lname> Rathod </lname> </name> <ssn> SSN245678 </ssn> <age> 28 </age> <room> 108 </room> <insurance type="primary"> <id> 2010456 </id> <gno> 216 </gno> <address> Raichur </address> </insurance> <insurance type="secondary"> <id> 646512 </id> <gno> 318 </gno> <address> Belagavi </address> </insurance> <medproblem> Sugar </medproblem> <drugallergie> Nill </drugallergie> </patient> </patients> <!--hospital.xsl--> <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org./TR/WD-xsl"> <xsl:template match="/"> <html> <head> <style>
  • 26. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. </style> </head> <body> <xsl:for-each select="patients/patient" order-by="ssn"> <h2> <xsl:value-of select="ssn"/> </h2> <p> <strong>Name:</strong> <xsl:value-of select="name/."/> </p> <p> <strong>Age: </strong> <xsl:value-of select="age/."/> </p> <p> <strong>Room:</strong> <xsl:value-of select="room/."/> </p> <p> <strong>Insurnce:</strong> <xsl:value-of select="insurance/."/> </p> </xsl:for-each> </body> </html> </xsl:template> </xsl:stylesheet>
  • 27. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. **OUTPUT**
  • 28. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. PART-III PHP PHP- Write, test and debug PHP scripts for the following specification 9)Parameter - A string of numbers separated by spaces Return Value – The first 4 digits number in the string; false if none. <html> <body> <?php function display($str) { $words=explode(" ", $str); $n=$words[0]; $n=substr($n,0,4); $n=(double) $n; return $n; } $str="1234567 4567785 6784953 8902123"; $n=display($str); echo $n; ?> </body> </html>
  • 29. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. **OUTPUT**
  • 30. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. 10)Parameter – A file variable of a file of text where the words are separated by spaces or colons Return value – The word that appears most common in the file. <?php function countfrequency($myFile) { $fh=fopen($myFile, 'r'); $theData=fread($fh,filesize($myFile)); $theData=eregi_replace(" +", " ", $theData); $delim=" "; $words=explode($delim,$theData); $frequency=array_count_values($words); $size=sizeof($frequency); $keys=array_keys($frequency); $values=array_values($frequency); for($i=0;$i<$size;$i++) { print "<b>$keys[$i]:</b> $values[$i]<br/>"; } $index=0; $l=$values[$index]; for($i=1;$i<$size;$i++) { if($values[$i]>$l) { $l=$values[$i]; $index=$i; } } return $keys[$index];
  • 31. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. } $myFile="testFile.txt"; $word=countfrequency($myFile); echo "The word that appears most common is:<b>$word</b>"; ?> //testFile.text BasavRaj Savalagi BMS Basavaraj Basava BasavRajSavalagi BasavRaj Basava BasavRaj Basava
  • 32. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. 11)Write an XHTML document to include an anchor tag, that calls a PHP document also write the called PHP document which returns a randomly choosen greeting from a list of five different greetings. The greetings must be stored as constant strings in the script. A random number between 0 and 4 can be computed with these line. #set the seed for mtrand with the number of microseconds #since the last full second of the clock mt_strand((double) microtime() * 1000000); $number=mtrand(0,4); #computes a random integer0-4 <!--greeting.html--> <?xml version="1.0" encoding="utf-8" ?> <html> <head> <title>Preferred Greeting page</title> </head> <body> Do you prefer a formal greeting or an informal greeting? <a href="greeting.php">Display greeting</a> </body> </html> <!--greeting.php--> <?php $greeting=array(); $greeting[0]="Hello ,how are you Mr BasavRaj?"; $greeting[1]="Hi how are you today?"; $greeting[2]="Welcome to the my php page world"; $greeting[3]="Good morning every one"; $greeting[4]="Good evening and Good nigth"; $n=mt_rand(0,4); echo $greeting[$n]; ?>
  • 33. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. **OUTPUT**
  • 34. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
  • 35. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. 11) Write the XHTML code to create the form with the following capabilities a) A text widget to collect the users name b) Four check boxes, one each for the following items i) Four 100 watt light bulbs for Rs. 20=39 ii) Eight 100 watt light bulbs for Rs 40=20 iii) Four 100 watt long life light bulbs for Rs. 30=95 iv) Eight 100 watt long life light bulbs for Rs 70=49 c) A collection of 3 radio buttons that are labeled as follows i) Visa ii) Master Card iii) Discover <--orderfron.html--> <?xml version="1.0" encoding="utf-8"?> <html> <head> <title> Order from </title> </head> <body> <form action=""> User name=<input type="text" name="myname" size="30"/> <br/> select the items: <br/> <input type="checkbox" name="b[]" value="20.39" checked="checked"/> four 100 watt light <br/> <input type="checkbox" name="b[]" value="40.20" checked="checked"/> eight 100 watt light <br/> <input type="checkbox" name="b[]" value="30.39" checked="checked"/> four 100 watt long life light <br/> <input type="checkbox" name="b[]" value="70.39" checked="checked"/> eight 100 watt long life light <br/> select the mode of the payment:<br/> <input type="radio" name="paymode" value="visa" checked="checked" />Visa <br/> <input type="radio" name="paymode" value="Master card" /> Master card <br/> <input type="radio" name="paymode" value="discover"/> Discover <br/> <input type="submit" value="Submit Order"/> <input type="reset" value="Clear the form" /> </form>
  • 36. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. </body> </html> **OUTPUT**
  • 37. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. 13)Write a PHP script that computes the total cost of the ordered light bulbs from the exercise 12 after adding 13.5% VAT. The program must inform the buyer of exactly what was ordered in table. <--orderfrom.html--> <?xml version="1.0" encoding="utf-8"?> <html> <head> <title> Order from </title> </head> <body> <form method="POST" action="calculate.php"> User name=<input type="text" name="myname" size="30"/> <br/> select the items: <br/> <input type="checkbox" name="b[]" value="20.39" checked="checked"/> four 100 watt light <br/> <input type="checkbox" name="b[]" value="40.20" checked="checked"/> eight 100 watt light <br/> <input type="checkbox" name="b[]" value="30.39" checked="checked"/> four 100 watt long life light <br/> <input type="checkbox" name="b[]" value="70.39" checked="checked"/> eight 100 watt long life light <br/> select the mode of the payment:<br/> <input type="radio" name="paymode" value="Visa" checked="checked" />Visa <br/> <input type="radio" name="paymode" value="Master card" /> Master card <br/> <input type="radio" name="paymode" value="Discover"/> Discover <br/> <input type="submit" value="Submit Order"/> <input type="reset" value="Clear the form" /> </form> </body> </html>
  • 38. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. <!--orderfrom.php--> <?php $name=$_POST["myname"]; $bulbs=$_POST["b"]; $pmode=$_POST["paymode"]; print "your name is: $name<br/>"; $total=0; for($i=0; $i<sizeof($bulbs); $i++) { $vat=$bulbs[$i]*0.135; $total=$total+$bulbs[$i]+$vat; } print "the total cost: $total<br/>"; print "your payment mode is by : $pmode"; ?>
  • 39. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. **OUTPUT**
  • 40. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. 14) Write a XHTML code to create a form that collects favorite popularsongs, including the name of the song, the composer and the performing artist or group. This document must call one PHP script when the form is submitted and another torequest a current list of survey results <!--Songform.html--> <?xml version="1.0" encoding="utf-8"?> <html> <head> <title> Song form </title> </head> <body> <form method="post" action="processform.php"> Song name: <input type="text" name="sname" size="30" /> <br/> Composer: <input type="text" name="cname" size="20"/> <br/> Artists: <br/> <input type="checkbox" name="artist[]" value="Flute Man" checked="checked"/> Flute Man<br/> <input type="checkbox" name="artist[]" value="Tabala Man" /> Tabala Man<br/> <input type="checkbox" name="artist[]" value="Violin Man" /> Violin Man <br/> <input type="checkbox" name="artist[]" value="support singers" /> Support Singers <br/> <input type="submit" value="submit form" /> <input type="reset" value="clear form" /> </form> </body> </html> <!--Processform.php--> <?php $songname=$_POST["sname"]; $compname=$_POST["cname"]; $artists=$_POST["artist"];
  • 41. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. print "song name is: $songname <br/> "; print "composer is: $compname <br/>" ; print "artists: <br/>"; for($i=0; $i<sizeof($artists); $i++) { print "$artists[$i] <br/>"; } ?> **OUTPUT**
  • 42. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. 15)Write a XHTML code to provide a form that collects names and telephone numbers. The phone numbers must be in the format ddd-ddd-dddd. Write a PHP script that checks the submitted telephone number to be sure that it confirms to the required format and then returns a response that indicates whether the number was correct. <!--Phoneform.html--> <?xml version="1.0" encoding="utf-8"?> <html> <head> </head> <body> <form method="post" action="validate.php"> Name:<input type="text" name="uname" size="30"/> <br/> Telephone Number:<input type="text" name="phone" size="20"/> <br/> <input type="submit" value="Submit Form"/> <input type="reset" value="clear form"/> </form> </body> </html> <!--validate.php--> <?php $name=$_POST["uname"]; $phon=$_POST["phone"]; if(ereg("([0-9]{3})-([0-9]{3})-([0-9]{4})", $phon)) { print "phone number entered is correct"; } else { print "phone number entered is incorrect";
  • 43. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. } ?> **OUTPUT**
  • 44. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
  • 45. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. 16)Modify the PHP script of exercise 11 to count the numberof visitors and display that number for each visitor Hint: Use a file to store current count. <!--countvisitors.php--> <?php $count = file_get_contents("count.txt"); $count = explode("=", $count); $count[1] =$count[1]+1; $file = fopen("count.txt", "w+"); fwrite($file, "count=".$count[1]); fclose($file); print "Total number of visitors=".$count[1]; ?> **OUTPUT**
  • 46. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg.
  • 47. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. 17) Accept from the user name, phone no , mail-ed ,store in database . retrieve same information from database using a separate PHP script <!-- `addressbook`.`book` --> <?xml version="1.0" encoding="utf-8"?> <html> <body> <form action="insert.php" method="post"> Name: <input type="text" name="uname" /> <br/> Phone: <input type="text" name="uphone" /> <br/> Email: <input type="text" name="email"/> <br/> <input type="Submit" value="Submit form"/> <input type="reset" value="Reset Form"/> </form> </body> </html> //insert.php <?php $username="root"; $password=""; $server="localhost"; $database="address_book1"; $name=$_POST['uname']; $phone=$_POST['uphone']; $email=$_POST['email']; mysql_connect($server,$username,$password); mysql_select_db($database); $query = "INSERT INTO address_book1 VALUES('$name','$phone','$email')";
  • 48. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. mysql_query($query); $query = "SELECT * FROM address_book1"; $sql_query = mysql_query($query); $row=mysql_fetch_array($sql_query); while ($row = mysql_fetch_array($sql_query)) { echo $row["name"]."<br/>"; echo $row["phone"]."<br/>"; echo $row["email"].""; echo ""; } mysql_close(); ?>
  • 49. Government Polytechnic Vijayapur 2016 Dept. of computer science and Engg. **OUTPUT**