You are on page 1of 67

Web Programming Laboratory

07MCA47
1.Develop and demonstrate a XHTML document that illustrates the use of external style
sheet, ordered list, table, borders, padding, color, and the span! tag.
//XHTML document for timetable
<html>
<head>MCA<title>EvenSemester</title></head>
<body>
<style>
sahana
!
font"si#e$%&'
border"bottom"style$dashed'
(
</style>
<CE)TE*><font color+,blue, class+sahana>*ao -ahadur .Mahabalesh/ara00a En1ineerin1
Colle1e</font>
<h2>3e0artment of Master of Com0uter A00lication</h2>
<h&>Time"Table for Even Semester %445"%446</h&>
<h7 ali1n+,left,>Sem$89</h7></CE)TE*></head>
<table border+:4>
<tr>
<th /idth+,5;,>3ay</th>
<th>5$44"6$44AM</th>
<th>6$44":4$44AM</th>
<th /idth+,%4;, ro/s0an+2>:4$44"
:4$<4AM<br>-</br><br>*</br><br>E</br>A</br><br>=</br></th>
<th>:4$<4"::$<4AM</th>
<th>::$<4":%$<4>M</th>
<th /idth+,%4;, ro/s0an+7>:%$<4"%$44>M
<br>L</br><br>?</br><br>)</br><br>C</br><br>H</br></th>
<th>%$44"<$44>M</th>
<th><$44"2$44>M</th>
<th>2$44"&$44>M</th>
</tr>
<tr ali1n+,center,>
<td>Mon</td>
<td><a href+,1html@A>,>A></a></td>
<td><a href+,1html@EA":,>EA":</a></td>
<td><a href+,1html@SE,>SE</a></td>
<td><a href+,1html@A3A,>A3A</a></td>
<td><a href+,1html@?S>,>?S></a></td>
<td cols0an+%>A3AB-<C</td>
</tr>
<tr ali1n+,center,>
<td>Tue</td>
Dept of MCA, RYMEC, Bellary. 00!"00# Page 1
Web Programming Laboratory
07MCA47
<td><a href+,1html@SE,>SE</a></td>
<td><a href+,1html@A3A,>A3A</a></td>
<td><a href+,1html@EA":,>EA":</a></td>
<td>"</td>
<td><a href+,1html@?S>,>?S></a></td>
<td cols0an+%>A>B-<C</td>
</tr>
<tr ali1n+,center,>
<td>Aed</td>
<td><a href+,1html@A3A,>A3A</a></td>
<td><a href+,1html@?S>,>?S></a></td>
<td><a href+,1html@EA":,>EA":</a></td>
<td>"</td>
<td><a href+,1html@SE,>SE</a></td>
<td><a href+,1html@A>,>A></a></td>
<td>"</td>
</tr>
<tr ali1n+,center,>
<td>Thur</td>
<td cols0an+2>A3AB-<CB?0to ::$44C</td>
<td><a href+,1html@A>,>A></a></td>
<td><a href+,1html@EA":,>EA":</a></td>
<td cols0an+%>DA9AB-<C</td>
</tr>
<tr ali1n+,center,>
<td>Eri</td><td>
<a href+,1html@?S>,>?S></a></td>
<td><a href+,1html@SE,>SE</a></td>
<td>-*EA=</td>
<td><a href+,1html@A>,>A></a></td>
<td><a href+,1html@A3A,>A3A</a></td>
<td cols0an+<>DA9AB-<C</td></tr>
<tr ali1n+,center,><td>Sat</td><td cols0an+&>A>B-<CB?0to ::$44C</td>
</tr>
</table>
<table border+% /idth+,:44;,>
<tr>
<td>EA": Shivanand=-</td>
<td>SE ATSatyanarayana *eddy</td>
</tr>
<tr>
<td>A> THeera Sin1h</td>
<td>A3A E)9 *aFesh</td>
</tr>
<tr>
<td>?S> THanumantha *eddy</td>
Dept of MCA, RYMEC, Bellary. 00!"00# Page 2
Web Programming Laboratory
07MCA47
<td>DavaLaboratory Shivanand=-</td>
</tr>
<tr>
<td>Aeb>ro1rammin1Laboratory THeera Sin1h</td>
<td>A3ALaboratory E)9*aFesh</td>
</tr>
</table>
</body></html>
//XHTML document for linGin1 Syllabus for 0articular subFectB1htmlC
<html>
<head>
<title>Syllabus >a1e</title>
</head>
<body>
<a href+,timetablehtml,>bacG to timetable</a>
<0 id+,EA":,><h:>EA":</h:>
<ol ty0e+,:,>
<li>8ntroduction to Dava
<li>ClassesH8nheritanceHEIce0tionsHA00lets
<li>Multi Threaded >ro1rammin1HEvent Handlin1
<li>S/in1s
<li>Dava % Enter0rise Edition Jvervie/H3atabase Access
<li>Servlets
<li>DS>H*M8
<li>Enter0rise Dava -eans
</ol>
<a href+,timetablehtml,>bacG to timetable</a>
<0 id+,SE,><h:>SE</h:>
<ol ty0e+,:,>
<li>Jvervie/
<li>Critical SystemsHSoft/are >rocesses
<li>*EKuirements
<li>System modelsH>roFect Mana1ement
<li>Soft/are 3esi1n
<li>3evelo0ment
<li>9erification and 9alidation
<li>Mana1ement
</ol>
<a href+,timetablehtml,>bacG to timetable</a>
<0 id+,A>,><h:>A></h:>
<ol ty0e+,:,>
<li>Eundamentals of /ebHXHTML":
<li>XHTML"%HCSS
<li>DavaScri0t
Dept of MCA, RYMEC, Bellary. 00!"00# Page 3
Web Programming Laboratory
07MCA47
<li>DavaScri0t and HTML 3ocumentsH3ynamic 3ocuments /ith DavaScri0t
<li>XML
<li>>erlHCL8 >ro1rammin1
<li>>H>
<li>3atabase Access
</ol>
<a href+,timetablehtml,>bacG to timetable</a>
<0 id+,A3A,><h:>A3A</h:>
<ol ty0e+,:,>
<li>8ntroduction
<li>Eundamentals of the Analysis of Al1orithm Efficiency
<li>3ivide and ConKuer
<li>3ecrease and ConKuer
<li>Transform and ConKuer
<li>S0ace and Time Tradeoffs
<li>3ynamic >ro1rammin1
<li>Lreedy TechniKues
<li>Limitations of Al1orithm >o/er
<li>Co0yin1 /ith the Limitations of Al1orithm >o/er
</ol>
<a href+,timetablehtml,>bacG to timetable</a>
<0 id+,?S>,><h:>?S></h:>
<ol ty0e+,:,>
<li>8ntroduction
<li>?)8X Eiles
<li>?)8X Eile A>8s
<li>?)8X >rocesses
<li>>rocess Control
<li>Si1nals and 3aemon >rocesses
<li>8nter0rocess Communication":
<li>8nter0rocess Communication"%
</ol>
</body>
</html>
Dept of MCA, RYMEC, Bellary. 00!"00# Page 4
Web Programming Laboratory
07MCA47
"utput for timetablehtml XHTML document$
Dept of MCA, RYMEC, Bellary. 00!"00# Page 5
Web Programming Laboratory
07MCA47
Dept of MCA, RYMEC, Bellary. 00!"00# Page 6
Web Programming Laboratory
07MCA47
"utput for 1html XHTML document$ 8t linGs to 0articular subFect /hen clicGed on that
0articular subFect in timetable
#$
: Eundamentals of /ebHXHTML":
% XHTML"%HCSS
< DavaScri0t
2 DavaScri0t and HTML 3ocumentsH3ynamic 3ocuments /ith DavaScri0t
& XML
7 >erlHCL8 >ro1rammin1
M >H>
5 3atabase Access
bacG to timetable
Dept of MCA, RYMEC, Bellary. 00!"00# Page 7
Web Programming Laboratory
07MCA47
%. Develop and demonstrate a XHTML file that includes &avascript for the follo'ing
problems
a( )nput* + number n obtained using prompt
"utput* The first n ,ibonacci numbers
<html>
<head>
<title>Eibonacci series</title>
</head>
<body>
<scri0t lan1ua1e+,Davascri0t,>
var f:+4Hf%+:Hf<Hi'
var n+0rom0tB,Enter the limit,H, ,C'
document/ritelnB,fibonacci series,H,</br>,Hf:H,</br>,Hf%H,</br>,C'
forBi+%'i<n'iNNC
!
f<+f:Nf%'
document/riteBf<N,</br>,C'
f:+f%'
f%+f<'
(
</scri0t>
</body>
</html>
"utput*
Dept of MCA, RYMEC, Bellary. 00!"00# Page 8
Web Programming Laboratory
07MCA47
Dept of MCA, RYMEC, Bellary. 00!"00# Page 9
Web Programming Laboratory
07MCA47
%.b( )nput* + number n obtained using prompt
Dept of MCA, RYMEC, Bellary. 00!"00# Page 10
Web Programming Laboratory
07MCA47
"utput* + table of numbers from 1 to n and their s-uares using alert
<html>
<head>
<marKuee style+,font family$sahana,'>Multi0lication Table</marKuee>
</head>
<body>
<table>
<scri0t lan1ua1e+,Favascri0t,>
var m:Hm%HiHnHFHsKr'
var str+,sKuares,'
n+0rom0tB,enter the number,H, ,C'
forBF+:'F<+n'FNNC
!
sKr+FOF'
strN+B,Pn,NFN,O,NFN,+,NsKrC'
(
alertBstrC'
forBi+:'i<+:4'iNNC
!
forBF+:'F<+n'FNNC
!
document/riteB,<td>,C'
m:+iOF'
document/riteBFH,O,HiH,+,Hm:C'
(
document/riteB,<tr>,C'
(
</scri0t>
</body>
</html>
"utput*
Dept of MCA, RYMEC, Bellary. 00!"00# Page 11
Web Programming Laboratory
07MCA47
Dept of MCA, RYMEC, Bellary. 00!"00# Page 12
Web Programming Laboratory
07MCA47
.. Develop / demonstrate a XHTML file that includes 0avascript that uses functions for
the follo'ing problems*
a( $arameter* + 1tring
"utput* The position in the string of the left2most vo'el
<html>
<head>
<title>Left"most vo/el</title>
<scri0t lan1ua1e+,Favascri0t,>
function vo/elBC
!
var str+documentmyformresultvalue'
var cHi'
forBi+4'i<strlen1th'iNNC
!
c+strcharAtBiC'
ifBc++QaQ RR c++QeQ RR c++QiQ RR c++QoQ RR c++QuQ RR c++QAQ RR c++QEQ RR c++Q8Q RR c++QJQ RR c++Q?QC
!
returnBiN:C'
((
return ":'
(
function dis0layBC
!
var i+vo/elBC'
ifBi++":C
documentmyformmyteItvalue+,vo/el not found,'
else
documentmyformmyteItvalue+,vo/el found at,Ni'
(
</scri0t>
</head>
<body>
<form name+,myform,>
<in0ut ty0e+,teIt, name+,result, value+, ,>
<in0ut ty0e+,teIt, name+,myteIt,value+, ,readonly>
<in0ut ty0e+,button, name+,btn, value+,find leftmost vo/el, onclicG+,dis0layBC,>
</form>
</body>
</html>
Dept of MCA, RYMEC, Bellary. 00!"00# Page 13
Web Programming Laboratory
07MCA47
"utput*
Dept of MCA, RYMEC, Bellary. 00!"00# Page 14
Web Programming Laboratory
07MCA47
..b( $arameter* + number
"utput* The number 'ith its digits in the reverse order
<html>
<head>
<title>*everse of a 1iven number</title>
</head>
<body>
<scri0t lan1ua1e+,Favascri0t,>
function reverseBnumC
!
var rev+4Hn:+numHrem'
/hileBnum>4C
!
rem+0arse8ntBnum;:4C'
rev+0arse8ntBrevO:4NremC'
num+0arse8ntBnum/:4C'
(
document/riteB,)umbers are+,Hn:H,</br>,C'
document/riteB,*everse numbers+,HrevC'
(
Dept of MCA, RYMEC, Bellary. 00!"00# Page 15
Web Programming Laboratory
07MCA47
var num+0rom0tB,Enter number to find reverse number,H,,C'
reverseBnumC'
</scri0t>
</body>
</html>
"utput$
Dept of MCA, RYMEC, Bellary. 00!"00# Page 16
Web Programming Laboratory
07MCA47
Dept of MCA, RYMEC, Bellary. 00!"00# Page 17
Web Programming Laboratory
07MCA47
3.a( Develop and demonstrate, using &avascript , a XHTML document that collects
the 415 6 the valid format is* + digit from 1 to 3 follo'ed by t'o upper2case characters
follo'ed by t'o digits follo'ed by t'o upper2case characters follo'ed by three digits7
no embedded spaces allo'ed( of the user. 8vent handler must be included for the form
element that collects this information to validate the input. Messages in the alert
'indo's must be produced 'hen errors are detected.
//html file for usn
<html>
<head>
<title>8llustrate form in0ut validation</title>
<scri0t ty0e+,teIt/Favascri0t, src+,usnFs,>
</scri0t>
</head>
<body>
<h<>Collects the ?S)</h<>
<form action + ,,>
<0>
?S)
<in0ut ty0e+,teIt, id+,?S))ame,>
</br></br></br>
<in0ut ty0e+,reset, id+,reset,>
<in0ut ty0e+,button, value+,checG, onclicG+,chG)ameBC,/>
</0>
</form>
</body>
</html>
//usnFs
function chG)ameBC
!
var my)ame+document1etElement-y8dB,?S))ame,C'
var str+,%4,'
var d+ne/ 3ateBC'
var tem0+ne/ *e1EI0B,ST:"2U!:(TA"VU!%(TPPdU!%(TA"VU!%(TPPdU!<(W,C'
var t+tem0testBmy)amevalueC'
ifBt++falseC
!
alertB,?S) entered is /ron1,C'
(
Else
Dept of MCA, RYMEC, Bellary. 00!"00# Page 18
Web Programming Laboratory
07MCA47
!
alertB,?S) entered is Correct,C'
(
(
"utput*
Dept of MCA, RYMEC, Bellary. 00!"00# Page 19
Web Programming Laboratory
07MCA47
Dept of MCA, RYMEC, Bellary. 00!"00# Page 20
Web Programming Laboratory
07MCA47
3.b(. Modify the above program to get the current semester also.
//html file for ?S)
<html>
<head>
<title>8llustrate form in0ut validation</title>
<scri0t ty0e+,teIt/Favascri0t, src+,usn:Fs,>
</scri0t>
</head>
<body>
<h<>Collects the ?S)</h<>
<form action + ,,>
<0>
?S)
<in0ut ty0e+,teIt, id+,?S))ame,>
</br></br></br>
<in0ut ty0e+,reset, id+,reset,>
<in0ut ty0e+,button, value+,checG, onclicG+,chG)ameBC,/>
</0>
</form>
</body>
</html>
//Favascri0t for usn:Fs
function chG)ameBC
!
var my)ame+document1etElement-y8dB,?S))ame,C'
var str+,%4,'
var d+ne/ 3ateBC'
var tem0+ne/ *e1EI0B,ST:"2U!:(TA"VU!%(TPPdU!%(TA"VU!%(TPPdU!%H<(W,C'
var t+tem0testBmy)amevalueC'
ifBt++falseC
!
alertB,?S) entered is /ron1,C'
(
else
!
strN+my)amevaluecharAtB<C'
strN+my)amevaluecharAtB2C'
Dept of MCA, RYMEC, Bellary. 00!"00# Page 21
Web Programming Laboratory
07MCA47
str+0arse8ntBstrC'
var cur+d1et.earBC'
var mon+d1etMonthBC'
str+cur"str'
strO+%'
ifBmon<7C
str+str'
else
strN+:'
ifBstr<+5C
alertB,current semester$,NstrC'
else
alertB,Semester -eyonds 5 sem,C'
my)amefocusBC'
my)ameselectBC'
((
"utput*
Dept of MCA, RYMEC, Bellary. 00!"00# Page 22
Web Programming Laboratory
07MCA47
Dept of MCA, RYMEC, Bellary. 00!"00# Page 23
Web Programming Laboratory
07MCA47
Dept of MCA, RYMEC, Bellary. 00!"00# Page 24
Web Programming Laboratory
07MCA47
9. a( Develop and demonstrate, using &avascript script, a XHTML document that contains
three short paragraphs of text, stac:ed on top of each other, 'ith only enough of each
sho'ing so that the mouse cursor can be placed over some part of them. #hen the
cursor is placed over the exposed part of any paragraph, it should rise to the top to
become completely visible.
<html>
<head>
<title>)e/ 3ocument</title>
<scri0t lan1ua1e+,Favascri0t,>
function fun:BC
!
document1etElement-y8dB,first,Cstylevisibility+,visible,'
var second+document1etElement-y8dB,second,C'
secondstyleto0+:44'
var third+document1etElement-y8dB,third,C'
(
function fun%BC
!
document1etElement-y8dB,first,Cstylevisibility+,visible,'
var second+document1etElement-y8dB,second,C'
Dept of MCA, RYMEC, Bellary. 00!"00# Page 25
Web Programming Laboratory
07MCA47
var third+document1etElement-y8dB,third,C'
(
function fun<BC
!
document1etElement-y8dB,seconda,Cstylevisibility+,visible,'
var second+document1etElement-y8dB,third,C'
thirdstyleto0+:74'
(
function fun2BC
!
document1etElement-y8dB,seconda,Cstylevisibility+,visible,'
var third+document1etElement-y8dB,third,C'
(
function fun&BC
!
document1etElement-y8dB,thirda,Cstylevisibility+,visible,'
(
function fun7BC
!
document1etElement-y8dB,thirda,Cstylevisibility+,visible,'
(
</scri0t>
</head>
<body>
<s0an style+,0osition$absolute'to0$24'left$%&, onmouseover+,fun:BC, onmouseout+,fun%BC,>
0lace mouse here to vie/ first 0ara1ra0h</s0an><br>
<s0an id+,first, style+,0osition$absolute'to0$74'left$%&'
visibility$hidden',>
8f file sharin1 is 0rohibited in your countryHdont do/nload it</s0an>
<s0an id+,second, style+,0osition$absolute'to0$54'left$%&', onmouseover+,fun<BC,
onmouseout+,fun2BC,>
0lace mouse here to vie/ second 0ara1ra0h</s0an><br>
<s0an id+,seconda, style+,0osition$absolute'to0$:%4'left$%&' visibility$hidden,>
This activity is Fust for Test/-acGu0 0ur0ose only</s0an>
<s0an id+,third, style+,0osition$absolute'to0$:%4'left$%&', onmouseover+,fun&BC,
onmouseout+,fun7BC,>
>lace mouse here to vie/ third 0ara1ra0h</s0an><br>
<s0an id+,thirda, style+,0osition$absolute'to0$:54'left$%&' visibility$hidden,>
This activity is Fust for test/bacGu0 0u0ose only</s0an>
</body>
</html>
"utput*
Dept of MCA, RYMEC, Bellary. 00!"00# Page 26
Web Programming Laboratory
07MCA47
Dept of MCA, RYMEC, Bellary. 00!"00# Page 27
Web Programming Laboratory
07MCA47
9.b(Modify the above document so that 'hen a paragraph is moved from the top
Dept of MCA, RYMEC, Bellary. 00!"00# Page 28
Web Programming Laboratory
07MCA47
1tac:ing position, it returns to its original position rather than to the bottom.
<html>
<head>
<title>)e/ 3ocument</title>
<scri0t lan1ua1e+,Favascri0t,>
function fun:BC
!
document1etElement-y8dB,first,Cstylevisibility+,visible,'
var second+document1etElement-y8dB,second,C'
secondstyleto0+:&4'
var third+document1etElement-y8dB,third,C'
thirdstyleto0+:54'
(
function fun%BC
!
document1etElement-y8dB,first,Cstylevisibility+,hidden,'
var second+document1etElement-y8dB,second,C'
secondstyleto0+M4'
var third+document1etElement-y8dB,third,C'
thirdstyleto0+64'
(
function fun<BC
!
document1etElement-y8dB,seconda,Cstylevisibility+,visible,'
var second+document1etElement-y8dB,third,C'
thirdstyleto0+:54'
(
function fun2BC
!
document1etElement-y8dB,seconda,Cstylevisibility+,hidden,'
var third+document1etElement-y8dB,third,C'
thirdstyleto0+64'
(
function fun&BC
!
document1etElement-y8dB,thirda,Cstylevisibility+,visible,'
(
function fun7BC
!
Dept of MCA, RYMEC, Bellary. 00!"00# Page 29
Web Programming Laboratory
07MCA47
document1etElement-y8dB,thirda,Cstylevisibility+,hidden,'
(
</scri0t>
</head>
<body>
<s0an style+,0osition$absolute'to0$24'left$%&, onmouseover+,fun:BC, onmouseout+,fun%BC,>
0lace mouse here to vie/ first 0ara1ra0h</s0an><br>
<s0an id+,first, style+,0osition$absolute'to0$74'left$%&'
visibility$hidden',>
8f file sharin1 is 0rohibited in your countryHdont do/nload it</s0an>
<s0an id+,second, style+,0osition$absolute'to0$54'left$%&', onmouseover+,fun<BC,
onmouseout+,fun2BC,>
0lace mouse here to vie/ second 0ara1ra0h</s0an><br>
<s0an id+,seconda, style+,0osition$absolute'to0$:44'left$%&' visibility$hidden,>
This activity is Fust for Test/-acGu0 0ur0ose only</s0an>
<s0an id+,third, style+,0osition$absolute'to0$:24'left$%&', onmouseover+,fun&BC,
onmouseout+,fun7BC,>
>lace mouse here to vie/ third 0ara1ra0h</s0an><br>
<s0an id+,thirda, style+,0osition$absolute'to0$:74'left$%&' visibility$hidden,>
This activity is Fust for test/bacGu0 0u0ose only</s0an>
</body>
</html>
"utput*
Dept of MCA, RYMEC, Bellary. 00!"00# Page 30
Web Programming Laboratory
07MCA47
Dept of MCA, RYMEC, Bellary. 00!"00# Page 31
Web Programming Laboratory
07MCA47
;. a( Design an XML document to store information about a student in an engineering
college affiliated to <T4. The information must include 415, 5ame, 5ame of the
=ollege, >ranch, ?ear of &oining, and e2mail id. Ma:e up sample data for . students.
=reate a =11 style sheet and use it to display the document.
//Iml document
<XIml version+,:4, encodin1+,8SJ"55&6":,X>
<Y"" Edited by XMLS0yZ "">
<XIml"stylesheet ty0e+,teIt/css, href+,7acss,X>
<ST?3E)T>
<3ETA8LS>
<T8TLE>ST?3E)T 8)EJ*MAT8J)</T8TLE>
</3ETA8LS>
<3ETA8LS>
<?S)><a>?S)$</a><9C4MMCA<7</?S)>
<)AME><a>)AME$</a>SAHA)A</)AME>
<CJLLELE><a>CJLLELE$</a>*.MEC</CJLLELE>
<-*A)CH><a>-*A)CH$</a>MCA</-*A)CH>
<.EA*JEDJ8)8)L><a>.ear of Doinin1$</a>%44M</.EA*JEDJ8)8)L>
Dept of MCA, RYMEC, Bellary. 00!"00# Page 32
Web Programming Laboratory
07MCA47
<EMA8L"83><a>Email"id$</a>sahana%4[rediffmailcom</EMA8L"83>
</3ETA8LS>
<3ETA8LS>
<?S)><a>?S)$</a><9C4MMCA24</?S)>
<)AME><a>)AME$</a>SAETHA</)AME>
<CJLLELE><a>CJLLELE$</a>*.MEC</CJLLELE>
<-*A)CH><a>-*A)CH$</a>MCA</-*A)CH>
<.EA*JEDJ8)8)L><a>.ear of Doinin1$</a>%44M</.EA*JEDJ8)8)L>
<EMA8L"83><a>Email"id$</a>s/etha\avanthiGa[1mailcom</EMA8L"83>
</3ETA8LS>
<3ETA8LS>
<?S)><a>?S)$</a><9C4MMCA2<</?S)>
<)AME><a>)AME$</a>9A*)8=A</)AME>
<CJLLELE><a>CJLLELE$</a>*.MEC</CJLLELE>
<-*A)CH><a>-*A)CH$</a>MCA</-*A)CH>
<.EA*JEDJ8)8)L><a>.ear of Doinin1$</a>%44M</.EA*JEDJ8)8)L>
<EMA8L"83><a>Email"id$</a>varniGadesai[1mailcom</EMA8L"83>
</3ETA8LS>
</ST?3E)T>
//7acss document
ST?3E)T
!
(
3ETA8LS
!
dis0lay$blocG'
color$,blacG,'
font"si#e$%40t'
font"family$,Times )e/ *oman,'
font"/ei1ht$bold'
border"style$solid'
(
T8TLE
!
color$,yello/,'
font"si#e$%40t'
Dept of MCA, RYMEC, Bellary. 00!"00# Page 33
Web Programming Laboratory
07MCA47
font"family$,Times )e/ *oman,'
teIt"decoration$underline'
teIt"indent$:&in'
(
a
!
teIt"ali1n$,left,'
color$,blacG,'
font"si#e$:50t'
font"family$,Times )e/ *oman,'
(
?S)
!
dis0lay$blocG'
color$,blacG,'
font"si#e$:50t'
font"family$,Times )e/ *oman,'
(
)AME
!
dis0lay$blocG'
color$,blacG,'
font"si#e$:50t'
font"family$,Times )e/ *oman,'
(
CJLLELE
!
dis0lay$blocG'
color$,blacG,'
font"si#e$:50t'
font"family$,Times )e/ *oman,'
(
-*A)CH
!
dis0lay$blocG'
color$,blacG,'
font"si#e$:50t'
font"family$,Times )e/ *oman,'
(
.EA*JEDJ8)8)L
Dept of MCA, RYMEC, Bellary. 00!"00# Page 34
Web Programming Laboratory
07MCA47
!
dis0lay$blocG'
color$,blacG,'
font"si#e$:50t'
font"family$,Times )e/ *oman,'
(
EMA8L"83
!
dis0lay$blocG'
color$,blacG,'
font"si#e$:50t'
font"family$,Times )e/ *oman,'
(
"utput*
Dept of MCA, RYMEC, Bellary. 00!"00# Page 35
Web Programming Laboratory
07MCA47
b( =reate an X1LT style sheet for one student element of the above document and use it
Dept of MCA, RYMEC, Bellary. 00!"00# Page 36
Web Programming Laboratory
07MCA47
to create a display of that element.
//Iml document
<XIml"stylesheet ty0e+,teIt/Isl, href+,7bIsl,X>
<ST?3E)T>
<details>
<?S)><9C4MMCA2<</?S)>
<)AME>9arniGa</)AME>
<CJLLELE>*.MEC</CJLLELE>
<-*A)CH>MCA</-*A)CH>
<.EA*>%44M</.EA*>
<EMA8L"83>varniGadesai[1mailcom</EMA8L"83>
</details>
</ST?3E)T>
//Isl document
<Isl$stylesheet version+,:4, Imlns$Isl+,htt0$//////<or1/:666/XSL/Transform,
Imlns+,htt0$//////<or1/:666/XHTML,>
<Isl$tem0late match+,ST?3E)T,>
<html>
<head>
<title>Isl document</title>
</head>
<body>
<h%>
<center>ST?3E)T 8)EJ*MAT8J)</center></EJ)T>
</h%>
<table border+,<, alli1n+,center,>
<tr>
<th>
<s0an style+,font"style$italic'font"si#e$%&',>?S)$</s0an>
</th>
<th>
<s0an style+,font"style$italic'font"si#e$%&',>)AME$</s0an>
</th>
<th>
<s0an style+,font"style$italic'font"si#e$%&',>CJLLELE$</s0an>
</th>
<th>
<s0an style+,font"style$italic'font"si#e$%&',>-*A)CH$</s0an>
</th>
<th>
<s0an style+,font"style$italic'font"si#e$%&',>.EA* JE DJ8)8)L$</s0an>
</th>
<th>
<s0an style+,font"style$italic'font"si#e$%&',>EMA8L"83$</s0an>
Dept of MCA, RYMEC, Bellary. 00!"00# Page 37
Web Programming Laboratory
07MCA47
</th>
</tr>
<Isl$for"each select+,details,>
<tr>
<td>
<Isl$value"of select+,?S),/>
</td>
<td>
<Isl$value"of select+,)AME,/>
</td>
<td>
<Isl$value"of select+,CJLLELE,/>
</td>
<td>
<Isl$value"of select+,-*A)CH,/>
</td>
<td>
<Isl$value"of select+,.EA*,/>
</td>
<td>
<Isl$value"of select+,EMA8L"83,/>
</td>
</tr>
</Isl$for"each>
</table>
</body>
</html>
</Isl$tem0late>
</Isl$stylesheet>
"utput*
Dept of MCA, RYMEC, Bellary. 00!"00# Page 38
Web Programming Laboratory
07MCA47
@. a( #rite a $erl program to display various 1erver )nformation li:e 1erver 5ame, 1erver
Dept of MCA, RYMEC, Bellary. 00!"00# Page 39
Web Programming Laboratory
07MCA47
1oft'are, 1erver protocol, =A) Bevision etc.
@Y/0erl/bin/0erleIe
use CL8'
Wc1i+ne/ CL8'
0rint Wc1i">header'
0rint Wc1i">start\htmlBQ>ro1ram :aQC'
0rint Wc1i">h:BQServer 8nformationsQC'
0rint Wc1i">hr'
0rint ,<table border+2 cell0addin1+%>,'
0rint ,<tr><td>SE*9E*\)AME$ </td><td>,H WE)9!QSE*9E*\)AMEQ(H ,</td></tr>,'
0rint ,<tr><td>SE*9E*\>*JTJCJL$ </td><td>,H WE)9!QSE*9E*\>*JTJCJLQ(H
,</td></tr>,'
0rint ,<tr><td>SE*9E*\SJETAA*E$ </td><td>,H WE)9!QSE*9E*\SJETAA*EQ(H
,</td></tr>,'
0rint ,<tr><td>LATEAA.\8)TE*EACE$</td><td>,H WE)9!QLATEAA.\8)TE*EACEQ(H
,</td></tr>,'
0rint ,</table>,'
0rint Wc1i">end\html'
"4T$4T*
Start>*un>htt0$//localhost/c1i"bin/0ro1:ac1i
Dept of MCA, RYMEC, Bellary. 00!"00# Page 40
Web Programming Laboratory
07MCA47
@.b. #rite a $erl program to accept 45)X command from a HTML form and to display
the output of the command executed.
@Y/0erl/bin/0erleIe
use CL8'
Wc1i+ne/ CL8'
0rint Wc1i">header'
0rint Wc1i">start\htmlBQ>ro1ram :bQC'
0rint Wc1i">h:BQ?niI Command EIecutorQC'
0rint Wc1i">hr'
0rint Wc1i">h<BQ>lease enter the uniI commandQC'
0rint Wc1i">start\formB "method+>Q0ostQH "action+>Q/c1i"bin/0ro1:bc1iQC'
0rint ,?niI Command$,'
0rint Wc1i">teItfieldB "name+>QcommandQH"value+>QQC'
0rint Wc1i">submitB "name+>QsubmitQH"value+>QEIecuteQC'
0rint Wc1i">endform'
0rint Wc1i">hr'
Wcommand+Wc1i">0aramB,command,C'
ifBWcommand ne ,,C
!
0rint , The out0ut of the uniI command$ Wcommand,'
Wout0ut+]Wcommand]'
0rint ,<0re>,'
0rint Wout0ut'
0rint ,</0re>,'
(
0rint Wc1i">hr'
0rint Wc1i">end\html'
Dept of MCA, RYMEC, Bellary. 00!"00# Page 41
Web Programming Laboratory
07MCA47
"4T$4T*
Start>*un>htt0$//localhost/c1i"bin/0ro1:ac1i
Dept of MCA, RYMEC, Bellary. 00!"00# Page 42
Web Programming Laboratory
07MCA47
C. a( #rite a $erl program to accept the 4ser 5ame and display a greeting message
randomly chosen from a list of 3 greeting messages.
@Y/0erl/bin/0erleIe
use CL8'
Wc1i+ne/ CL8'
0rint Wc1i">header'
0rint Wc1i">start\htmlBQ>ro1ram %aQC'
0rint Wc1i">h:BQLreetin1 a ?serQC'
0rint Wc1i">hr'
0rint Wc1i">h<BQ3ear ?ser <br> Enter the usernameQC'
0rint Wc1i">start\formB "method+>Q0ostQH"action+>Q/c1i"bin/1reetc1iQC'
0rint ,?ser )ame$,'
0rint Wc1i">teItfieldB "name+>QusernameQH"value+>QQC'
0rint Wc1i">submitB "name+>QsubmitQH"value+>Q>rocessQC'
0rint Wc1i">reset '
0rint Wc1i">endform'
0rint Wc1i">hr'
0rint Wc1i">end\html'
1ave* C$P>ro1ram EilesPA0ache Soft/are EoundationPA0ache%%Pc1i"binP0r15c1i
@Y/0erl/bin/0erleIe
use CL8'
Wc1i+ne/ CL8'
0rint Wc1i">header'
0rint Wc1i">start\htmlBQ>ro1ram <QC'
0rint Wc1i">h:BQ<center>Aelcome</center>QC'
0rint ,Wusername,'
0rint Wc1i">hr'
BWsecHWminHWhourC+localtimeBtimeC'
ifBWhour> %< RR Whour< 7C
!
W1reet+,u r % early,'
(
elsifBWhour>+ 7 ^^ Whour< :%C
!
W1reet+,a very 1ud mr1 % u,'
(
elsifBWhour>+ :% ^^ Whour< :5C
!
W1reet+,1ud afternoon % u,'
Dept of MCA, RYMEC, Bellary. 00!"00# Page 43
Web Programming Laboratory
07MCA47
(
else
!
W1reet+,1ud nite,'
(
Wtime+s0rintfB,;4%d$;4%d$;4%d,HWhourHWminHWsecC'
0rint,<font si#e+&N color+blue><center>the time is</font><font si#e+:4N color+red> Wtime
<h%><i>W1reet</i></h%>,'
1ave* C$P>ro1ram EilesPA0ache Soft/are EoundationPA0ache%%Pc1i"binP1reetc1i
"4T$4T*
1tart!Bun!http*DDlocalhostDcgi2binDprgC.cgi
Dept of MCA, RYMEC, Bellary. 00!"00# Page 44
Web Programming Laboratory
07MCA47
C.b( #rite a $erl program to :eep trac: of the number of visitors visiting the 'eb page and
to display this count of visitors, 'ith proper headings.
@Y/0erl/bin/0erleIe
use CL8'
Wc1i+ne/ CL8'
0rint Wc1i">header'
0rint Wc1i">start\htmlBQ>ro1ram 5bQC'
0rint Wc1i">h:BQ<center>Server >a1e 9isited 8nformations</center>QC'
0rint Wc1i">hr'
Wcount\file+,c$/counttIt,'
ifBo0enBE8LEH,<,Wcount\fileCC !
Wno\accesses+<E8LE>'
closeBE8LEC'
ifBo0en BE8LEH,>,Wcount\fileCC !
Wno\accessesNN'
0rint E8LE Wno\accesses'
closeBE8LEC'
(
else !
0rint ,Cannot /rite the file )o 9isitors information in the server,'
( ( else !
0rint ,cannot read the counter database for visitors,'
(
0rint ,Aelcome ?ser,'
0rint ,<-*><-*>This 0a1e has been accessed <font color+red si#e+:4> Wno\accesses </font>
times from the creation,'
0rint Wc1i">end\html'
1ave* C$P>ro1ram EilesPA0ache Soft/are EoundationPA0ache%%Pc1i"binP5bc1i
Create one file named counttIt
Dept of MCA, RYMEC, Bellary. 00!"00# Page 45
Web Programming Laboratory
07MCA47
1ave* C$PcounttIt
"4T$4T*
1tart!Bun!http*DDlocalhostDcgi2binDCb.cgi
Dept of MCA, RYMEC, Bellary. 00!"00# Page 46
Web Programming Laboratory
07MCA47
E. #rite a $erl program to display a digital cloc: 'hich displays the current time of the
server.
@Yc$/0erl/bin/0erleIe
use CL8'
Wc1i+ne/ CL8'
0rint Wc1i">header'
0rint Wc1i">start\htmlBQ>ro1ram 6QC'
0rint Wc1i">h:BQ<center>Server Time on 3i1ital ClocGQC'
0rint Wc1i">hr'
BWsecondsHWminutesHWhourC+localtimeBtimeC'
ifBWhour>:%C !
Whour"+:%'
Wam0m+Q>MQ'
(
else
!
Wam0m+QAMQ'
(
ifBWhour++4C
!
Whour+:%'
(
Wtime+s0rintfB,;4%d$;4%d$;4%d ;s,HWhourHWminutesHWsecondsHWam0mC'
0rint ,?ser$ the Time is<br><br>,'
0rint Wtime,</center>,'
0rint Wc1i">hr'
0rint Wc1i">end\html'
Dept of MCA, RYMEC, Bellary. 00!"00# Page 47
Web Programming Laboratory
07MCA47
"4T$4T*
Start>*un>htt0$//localhost/c1i"bin/0ro16c1i
Dept of MCA, RYMEC, Bellary. 00!"00# Page 48
Web Programming Laboratory
07MCA47
1F. #rite a $erl program to insert name and age information entered by the user into a
table created using My1GL and to display the current contents of this table.
@Yc$/0erl/bin/0erleIe
@
@ 7 >ro1ram to insert ne/ name and a1e into the database
@
use Ain<%$$J3-C'
use CL8'
Wc1i+ne/ CL8'
0rint Wc1i">header'
0rint Wc1i">start\htmlBQ>ro1ram 7QC'
0rint Wc1i">h:BQ<center>3atabase 8nsertion J0eration</center>QC'
0rint Wc1i">hr'
Wdatabase+ne/ Ain<%$$J3-CB,myo/n,C'
Wtable+,myo/n,'
0rint ,<center>Enter the information belo/ to save<br><br>,'
WKuery+,select maIBuseridC from Wtable,'
Wdatabase">SKlBWKueryC'
[fieldnames+Wdatabase">Eield)amesBC'
0rint ,<form method+0ost action+/c1i"bin/0ro17savec1i>,'
0rint Wc1i">tableB!"border+>4H"cell0addin1+>:4H"cells0acin1+>4(C'
0rint Wc1i">ca0tionBQ<b><i>?ser 8nformation</i></b>QC'
ifBWdatabase">Eetch*o/BCC
!
;data+Wdatabase">3ataHashBC'
0rint Wc1i">TrB!"vali1n+>to0H"ali1n+>center(C'
0rint Wc1i">tdBQ?seridQC'
0rint ,<in0ut ty0e+hidden name+userid value+,NNWdata!QmaIBuseridCQ(,>,'
0rint Wc1i">tdBQ<in0ut ty0e+teIt name+userid value+QWdata!QmaIBuseridCQ(Q
disabled>QC'
(
0rint Wc1i">TrB!"vali1n+>to0H"ali1n+>center(C'
0rint Wc1i">tdBQ)ame$QC'
0rint Wc1i">tdBQ<in0ut ty0e+teIt name+name:>QC'
Dept of MCA, RYMEC, Bellary. 00!"00# Page 49
Web Programming Laboratory
07MCA47
0rint Wc1i">TrB!"vali1n+>to0H"ali1n+>center(C'
0rint Wc1i">tdBQA1e$QC'
0rint Wc1i">tdBQ<in0ut ty0e+teIt name+a1e>QC'
0rint Wc1i">TrB!"vali1n+>to0H"ali1n+>center(C'
0rint Wc1i">td'
0rint Wc1i">tdBQ<in0ut ty0e+submit value+Submit> <in0ut ty0e+reset
value+Clear>QC'
0rint ,</table>,'
0rint ,</form></center>,'
0rint Wc1i">end\html'
1ave* C$P>ro1ram EilesPA0ache Soft/are EoundationPA0ache%%Pc1i"binP0ro17c1i
@Yc$/0erl/bin/0erleIe
@ 0ro17savec1i " %nd 0art
@>ro1ram to 1et and insert ne/ name and a1e information into the database
@
use CL8'
use Ain<%$$J3-C'
Wc1i+ne/ CL8'
0rint Wc1i">header'
0rint Wc1i">start\htmlBQ%nd 0art of 0ro1ram 7QC'
0rint Wc1i">h:BQ<center>3atabase Save 8nformationQC'
0rint Wc1i">hr'
Wuserid+Wc1i">0aramBQuseridQC'
Wname+Wc1i">0aramBQname:QC'
Wa1e+Wc1i">0aramBQa1eQC'
Wdatabase+ne/ Ain<%$$J3-CB,myo/n,C'
WKuery+,insert into myo/n valuesBPQWnamePQHWa1eC,'
Wdatabase">SKlBWKueryC'
0rint ,3ear user Wname$<br><br>,'
0rint ,.our information has been saved,'
0rint ,<br><br><a href+/c1i"bin/0ro17c1i>-acG</a></center>,'
0rint Wc1i">hr'
0rint Wc1i">end\html'
1ave* C$P>ro1ram EilesPA0ache Soft/are EoundationPA0ache%%Pc1i"binP0ro17savec1i
Start>all 0ro1rams>MyS_L>MyS_L Server &:>MyS_L Command Line Client>
Enter 0ass/ord
Dept of MCA, RYMEC, Bellary. 00!"00# Page 50
Web Programming Laboratory
07MCA47
OOO
mysKl> create user QvarniGaQ identified by QvarniGaQ'
_uery J=H 4 ro/s affected B44& secC
mysKl> create database library'
_uery J=H : ro/ affected B44< secC
mysKl> use library
3atabase chan1ed
mysKl> create table myo/n
"> B
"> name charB:4CH
"> a1e intC'
_uery J=H 4 ro/s affected B4:< secC
J?T>?T$
:Start>control 0anel>administrative toos> 3ata Sources BJ3-CC>
%select system 3S) tab>add>clicG
<Select MyS_L server &: 3river
2 3ata Source )ame$myo/n
&Server$localhost
7?ser$varniGa
M0ass/ord$varniGa
5data base$library
6$clicG oGHoGHoG
Start>run> htt0$//localhost/c1i"bin/0ro17c1i
Dept of MCA, RYMEC, Bellary. 00!"00# Page 51
Web Programming Laboratory
07MCA47
See out0ut in MysKl
Dept of MCA, RYMEC, Bellary. 00!"00# Page 52
Web Programming Laboratory
07MCA47
11. #rite a $H$ program to store current date2time in a =""H)8 and display the ILast
visited onJ date2time on the 'eb page upon reopening of the same page.

<X
// 1et current date information as associative array
ifBissetBW\CJJ=8ETQ3ateeQUCC
!
WcooGiedate + W\CJJ=8ETQ3ateeQU'
(
Wtodayh + 1etdateBC'
Wd + WtodayhTmdayU'
Wm + WtodayhTmonU'
Dept of MCA, RYMEC, Bellary. 00!"00# Page 53
Web Programming Laboratory
07MCA47
Wy + WtodayhTyearU'
Whr + WtodayhThoursU'
Wmi + WtodayhTminutesU'
Wse + WtodayhTsecondsU'
Wdatestrin1 +,Wd"Wm"WyH Whr$Wmi$Wse,'
setcooGieB,3atee,HWdatestrin1C'
0rint ,>ro1ram for creatin1 and dis0layin1 cooGie,'
0rint,<br>,'
echo ,<br>HelloH ,WcooGiedate,Y last visitedY,'
0rint,<br>,'
X>

1ave* C$P>ro1ram EilesPA0ache Soft/are EoundationPA0ache%%PhtdocsP0r1::0h0
Bun
Start>run> htt0$//localhost/0r1::0h0
Dept of MCA, RYMEC, Bellary. 00!"00# Page 54
Web Programming Laboratory
07MCA47
1%. #rite a $H$ program to store page vie's count in 1811)"5, to increment the count on
each refresh, and to sho' the count on 'eb page.
Dept of MCA, RYMEC, Bellary. 00!"00# Page 55
Web Programming Laboratory
07MCA47
<X0h0
session\startBC'
ifBissetBW\SESS8J)TQcountQUCC!
0rint ,.our session count$ ,W\SESS8J)TQcountQU ,<br>,'
W\SESS8J)TQcountQUNN'
( else !
W\SESS8J)TQcountQU + :'
0rint ,Session does not eIist,'
(
X>
1ave* C$P>ro1ram EilesPA0ache Soft/are EoundationPA0ache%%PhtdocsP0h0:%0h0
"utput*2
Bun
Start>run> htt0$//localhost/0r1:%0h0
After refresh the sessions out0ut is vie/ed as belo/
Dept of MCA, RYMEC, Bellary. 00!"00# Page 56
Web Programming Laboratory
07MCA47
1.. =reate a XHTML form 'ith 5ame, +ddress Line 1, +ddress Line %, and 82mail text
fields. "n submitting, store the values in My1GL table. Betrieve and display the data
based on 5ame.
Dept of MCA, RYMEC, Bellary. 00!"00# Page 57
Web Programming Laboratory
07MCA47
<HTML>
<HEA3>
<T8TLE> )e/ 3ocument </T8TLE>
</HEA3>
<-J3. b1color+cyan>
<form method+,1et, action+,0h0:<0h0,><br><EJ)T CJLJ*+,oran1e,>
<h:><center>-JJ= 8)EJ*MAT8J)</h:>
<table ali1n+center><tr><td>Enter )ame</td>
<td><in0ut ty0e+,teIt, name+,name,></td></tr>
<tr><td>enter address:</td><in0ut ty0e+,teIt, name+,add:,></td></tr>
<tr><td>enter address%</td><in0ut ty0e+,teIt, name+,add%,></td></tr>
<tr><td>enter email</td><in0ut ty0e+,teIt, name+,email,></td></tr>
</table><br><br>
<center><in0ut ty0e+,reset, value+,CLEA*,><br><br>
<center><in0ut ty0e+,submit, value+,8)SE*T,>
</form>
</-J3.>
</HTML>
1ave* C$P>ro1ram EilesPA0ache Soft/are EoundationPA0ache%%PhtdocsP0h0:<html
<html>
<head>
<title> name and address database /ith MyS_L </title>
</head>
<body>
<X0h0
// Connect to MyS_L
Wdb + mysKl\connectB,localhost,H ,anu,H ,anu,C'
if BYWdbC !
0rint ,Error " Could not connect to MyS_L,'
eIit'
(
Wname + W\LETTQnameQU'
Wadd: + W\LETTQadd:QU'
Wadd% + W\LETTQadd%QU'
Wemail + W\LETTQemailQU'
Dept of MCA, RYMEC, Bellary. 00!"00# Page 58
Web Programming Laboratory
07MCA47
Wsname+W\LETT`snameaU'
Wc + ,insert into contact BnameHadd:Hadd%HemailC values BQ, Wname ,QHQ, Wadd: ,QHQ, Wadd%
,QHQ, Wemail ,QC,'
Wer + mysKl\select\dbB,em0,C'
if BYWerC !
0rint ,Error " Could not select the EM> database, mysKl\errorBC'
eIit'
(
Wa + mysKl\KueryB Wc C'
Wres + mysKl\KueryB,select O from contact /here name + QWsnameQ,C'
Wcount + mysKl\num\ro/sBWresC'
Wcol + mysKl\num\fieldsBWresC'
//0rint ,Totoal Cols 0resent in -ooG Table , Wcol ,<br>,'
0rint ,<table border+:>,'
/hile B Wro/ + mysKl\fetch\arrayBWresCC
!
0rint ,<tr>,'
Wi+4'
/hileBWi < WcolC
!
0rint ,<td>, Wro/TWiU'
Wi + Wi N:'
(
(
X>
</body>
</html>
1ave* C$P>ro1ram EilesPA0ache Soft/are EoundationPA0ache%%PhtdocsP0h0:<0h0
Dept of MCA, RYMEC, Bellary. 00!"00# Page 59
Web Programming Laboratory
07MCA47
"utput*2
Create a table in MysKl /ith name 0erson and /ith attributes in the 0ro1ram
8nsert ro/s as sho/n belo/
Bun
Start>run> htt0$//localhost/0h0:<html
Dept of MCA, RYMEC, Bellary. 00!"00# Page 60
Web Programming Laboratory
07MCA47
Dept of MCA, RYMEC, Bellary. 00!"00# Page 61
Web Programming Laboratory
07MCA47
Dept of MCA, RYMEC, Bellary. 00!"00# Page 62
Web Programming Laboratory
07MCA47
13. 4sing $H$ and My1GL, develop a program to accept boo: information viK. +ccession
number, title, authors, edition and publisher from a 'eb page and store the information
in a database and to search for a boo: 'ith the title specified by the user and to display
the search results 'ith proper headings.
<html>
<head>
<title> Access the library database /ith MyS_L </title>
</head>
<body>
<X0h0
// Connect to MyS_L
Wdb + mysKl\connectB,localhost,H ,varniGa,H ,varniGa,C'
if BYWdbC !
0rint ,Error " Could not connect to MyS_L,'
eIit'
(
Wacn + W\LETTQacnQU'
Wtit + W\LETTQtitQU'
Waut + W\LETTQautQU'
Wedi + W\LETTQediQU'
W0ub + W\LETTQ0ubQU'
Wc + ,insert into booG BacnHtitHautHediH0ubC values B, Wacn ,HQ, Wtit ,QHQ, Waut ,QHQ, Wedi
,QHQ, W0ub ,QC,'
// Select the library database
Wer + mysKl\select\dbB,library,C'
if BYWerC !
0rint ,Error " Could not select the library database, mysKl\errorBC'
eIit'
(
Wa + mysKl\KueryB Wc C'
Wres + mysKl\KueryB,select O from booG,C'
Wcount + mysKl\num\ro/sBWresC'
Wcol + mysKl\num\fieldsBWresC'
0rint,<form action+01m:2html><in0ut ty0e+submit value+-AC=>,'
0rint,<h:>-ooG 8nformation</h:>,'
0rint ,<table border+:>,'
/hile B Wro/ + mysKl\fetch\arrayBWresCC
!
Dept of MCA, RYMEC, Bellary. 00!"00# Page 63
Web Programming Laboratory
07MCA47
0rint ,<tr>,'
Wi+4'
/hileBWi < WcolC
!
0rint ,<td>, Wro/TWiU'
Wi + Wi N:'
(
(
X>
</body>
</html>
Save$ C$P>ro1ram EilesPA0ache Soft/are EoundationPA0ache%%PhtdocsP01m:20h0
<HTML>
<HEA3>
<T8TLE> )e/ 3ocument </T8TLE>
</HEA3>
<-J3.>
<form method+,1et, action+,01m:20h0,><br>
<h:><center>-JJ= 8)EJ*MAT8J)</h:>
<table ali1n+center>
<tr><th>Enter acession number</th><td><in0ut ty0e+,teIt, name+,acn,></td></tr>
<tr><th>enter title</th><td><in0ut ty0e+,teIt, name+,tit,></td></tr>
<tr><th>enter author name</th><td><in0ut ty0e+,teIt, name+,aut,></td></tr>
<tr><th>enter edition </th><td><in0ut ty0e+,teIt, name+,edi,></td></tr>
<tr><th>enter 0ublication</th><td><in0ut ty0e+,teIt, name+,0ub,></td></tr>
</table><br><br>
<center><in0ut ty0e+,reset, value+,CLEA*,><br><br>
<center><in0ut ty0e+,submit, value+,8)SE*T,>
</form>
</-J3.>
</HTML>
Save$ C$P>ro1ram EilesPA0ache Soft/are EoundationPA0ache%%PhtdocsP01m:2html
Start>all 0ro1rams>MyS_L>MyS_L Server &:>MyS_L Command Line Client>
Enter 0ass/ord
OOO
mysKl> create user QvarniGaQ identified by QvarniGaQ'
_uery J=H 4 ro/s affected B44& secC
Dept of MCA, RYMEC, Bellary. 00!"00# Page 64
Web Programming Laboratory
07MCA47
mysKl> create database library'
_uery J=H : ro/ affected B44< secC
mysKl> use library
3atabase chan1ed
mysKl> 1rant all on libraryO to QvarniGaQ[QlocalhostQ identified by QvarniGaQ'
_uery J=H 4 ro/s affected B444 secC
mysKl> create table booG
"> B
"> acn intH
"> tit charB:4CH
"> aut charB:4CH
"> edi charB:4CH
"> 0ub charB:4C
"> C'
_uery J=H 4 ro/s affected B445 secC
"4T$4T*
Start>*un>htt0$//localhost/01m:2html
Dept of MCA, RYMEC, Bellary. 00!"00# Page 65
Web Programming Laboratory
07MCA47
Dept of MCA, RYMEC, Bellary. 00!"00# Page 66
Web Programming Laboratory
07MCA47
Dept of MCA, RYMEC, Bellary. 00!"00# Page 67

You might also like