Dynamic Web Page Development

Download as pdf or txt
Download as pdf or txt
You are on page 1of 39

DYNAMIC WEB PAGE DEVELOPMENT

Subject Code:3350702
Practical List
Name : jay prajapati

enrollment no . 196450307117

1. Write HTML codes for displaying image and demonstrate hyper linking.

<html>

<head>

<title> hyper link demo...</title>

<body>

<a href="C:\Users\ASUS\Desktop\img.jpg">below images is also in this link</a>

<br>

<img src="C:\Users\ASUS\Desktop\img.jpg" alt="my image" width="500" height="377">

</body>

</head>

</html>
2. Write HTML codes to attach video on webpage using embed tag in html.

<html>
<body>
<title>assithree</title>
<h1 align="center">Video Attach on Webpage</h1>
<hr>

<object data="C:\Users\ASUS\Downloads\video.mp4" width="900" hight="900">


</object>
</body>
</html>
3. Create A Feedback Form Using Form handling.

<html>

<body style="text-align: center; background: grey;" >

<h1> Feedback form </h1>

<hr>

<form>

Name <input type="text" size="30px" />

<br>

<br>

Enrollment <input type="text" size="30px" />

<br>

<br>

Email <input type="email" size="30px" />

<br>

<br>

Select your category &nbsp

<input type = "radio"checked > Male

<input type="radio" > Female <br>

<br>

<br>

<textarea cols="50" rows="3" placeholder="Write your review"></textarea>

<br>

<br>
<input type="submit" value="Submit">

4. Create a contact form using form handling.


<html>

<body bgcolor=#757A82 ><font size="5%">

<h1 align="center"><font face="Castellar" color="#333333" > contact from</font></h1>

<hr>

<form><br>

contact : <input type="text" name="contact"/><br></br>

Email : <input type="email"><br> </br>

mobile no. <input type="text"> <br></br>

Birth date : <input type="date"><br></br>

Address : <textarea rows="6" cols="40"> </textarea><br></br>

Rename : <input type = "file"><br></br>

<input type="submit">

</from>

</body>

</html>
5. Write a code for creating static page design using division tag
<html>

<body >

<A href="chapters.htm">home</A> <br>

<p><div style= "font-size : 18pt ; font-family : verdana"> A paragraph is a series of related


sentences developing a central idea, called the topic. Try to think about paragraphs in terms of
thematic unity: a paragraph is a sentence or a group of sentences that supports one central, unified
idea.&reg;</div></font> </p>

<hr>

<br>

<p><div style= "font-size : 18pt ; font-family : Castellar">

What Does Java Mean? Java is an object-oriented programming language that produces software
for multiple platforms. When a programmer writes a Java application, the compiled code (known as
bytecode) runs on most operating systems (OS), including Windows, Linux and Mac
OS.&forall;</div></font> </p>

<hr>

<br>

<p><div style= "font-size: 20pt ; font-family: Brush Script MT">


photosynthesis, the process by which green plants and certain other organisms transform light
energy into chemical energy. During photosynthesis in green plants, light energy is captured and
used to convert water, carbon dioxide, and minerals into oxygen and energy-rich organic
compounds.</div></font> </p>

<p>

Our company JP Technologies &copy;

</p>

</body>

</html>

6. Write a code for design menu system using list tag.

<html >

<head>

<style>

li{

display : inline-block ;

box-shadow :0px 0px 50px blue;

background-color : white;

a{

color : black;
}

.menu {

border-radius: 90px 40px 90px 40px ;

padding : 6px;

font-family : Copperplate Gothic Light;

font-size : 120%;

</style>

</head>

<body>

<div class = "menu">

<ul type="circle" >

<li ><a href="#">home</a></li>

<li><a href="#">about</a></li>

<li><a href="#">contact</a></li>

<li><a href="#">about</a></li>

</ul>

</div>

</body>

</html>
7. Design Google Page using HTML5.

<html >
<head>

<style>

li{

display : inline-block ;
border-radius:19px 16px 16px 16px;
background-color : #00FFFF ;
}
a{

padding : 7px;
color : black;

}
.menu {
background : ;
font-family : Century Schoolbook ;
font-size : 140%;
}
img
{
display: block;
margin-top: 11%;
margin-bottom: auto;
margin-left: auto;
margin-right: auto;

.b{ text-align : margin-right ;}

</style> </head>

<body bgcolor ="black">


<div class = "menu">
<ul type="circle" > <li ><a href="#">home</a></li>
<li><a href="#">history</a></li>
<li><a href="#">view</a></li>
<li><a href="#">about</a></li>
</div>
<div class="google">
<img
src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.p
ng" alt="Google"/></a>
</div> <center><input type="search" size="50%" placeholder="search Here" > <button
class="btn">search</button></center>

<br>

<center> <li> <a href="https://www.google.com/maps/">Maps</a></li>


<li> <a href="https://www.youtube.com/">youtube</a></li>
<li> <a href="https://mail.google.com/">Gmail</a></li>
</center>
</div>
</body>
</html>

8. Apply CSS formatting to created pages and explore it fully, also use readymade css templates.

<html>

<head>

<style type="text/css">

li{

display : inline-block ;
box-shadow :10px 10px 50px lightyellow;

width: 130px;

height: 30px;

text-align: center;

background-color : white;

a{

color : black;

.menu {

border-radius: 90px 40px 90px 40px ;

padding : 6px;

font-family : Copperplate Gothic Light;

font-size : 150%;

img {

margin : 30px 30px;

width: 1320px ;

height: 400px ;

background: lightyellow;

transition: width height 4s ;

#div1{ width: 1420px ; height: 450px; text-align: center; position: relative

; animation: eleft 10s infinite ; }

@keyframes eleft {

0%{left :0px;}
30%{right: 500px;background: grey;border-radius:60px 40px 90px 40px;}

60%{top: 0px;left : 0px ;background: lightyellow;border-radius:60px 40px 70px 40px; }

/*.p{

text-align: center;

position: relative;

animation: list 5s infinite;

@keyframes list{

0%{top: 0px; }

40%{top: 30px;}

70%{top : 80px;}

80%{top : 90px; }

}*/

#scroll{

border:3px solid red;

border-radius: 5px;

height: 300px;

overflow: hidden;
background: grey;

#scrool-a{

height: 100%;

text-align: center;

-moz-transform: translateY(-100%);

/* -webkit-transform: translateY(-100%);*/

transform: translateY(-900%);

-moz-animation: my-animation 5s linear infinite;

-webkit-animation: my-animation 5s linear infinite;

animation: my-animation 5s linear infinite;

/*@-webkit-keyframes my-animation {

from { -webkit-transform: translateY(100%); }

to { -webkit-transform: translateY(100%); }

}*/

@keyframes my-animation {

from {

-moz-transform: translateY(-100%);

/*-webkit-transform: translateY(-100%);*/

transform: translateY(-100%);

}
to {

-moz-transform: translateY(100%);

-webkit-transform: translateY(100%);

transform: translateY(100%);

</style>

</head>

<body bgcolor="skyblue">

<ur><div style=" text-align:center ;

font-size:150%;

border: thick green ;

border-width:5px;

border-radius:90px 90px 0px 0px;

background: lightyellow;

height:50px;font-size:40px ;

text-shadow:4px 4px 8px red;

box-shadow: 10px 14px 8px blue "><ur> Shree K J Polytechnic,bharuch</ur></div></ur>

<br>

<br>

<hr size="10" color="grey" >

<div class = "menu" align="right" style="width:1400px ">

<ul type="circle" >

<li ><a href="#">home</a></li>

<li><a href="#">about</a></li>
<li><a href="#">contact</a></li>

<li><a href="#">about</a></li>

</ul>

</div>

<hr size="10" color="lightgreen " >

<br>

<br>

<div id="div1" align="center"><img src="E:\prog\k j DWPD nisha maam\gtu.png" align="center"


width="200" height="200"></div>

<hr size="10" color="lightgreen " >

<h2 align="center"><font size="90" face="Copperplate Gothic Light"


color="darkblue">Department</font></h2>

<hr size="10" >

<div id="scroll"> <div id="scrool-a"><div style="text-align:center;font-size:40;">

computer

<br>

chemical

<br>

mechanical

<br>

petro chemical

<br>

electrical

<br>
information technology</div></div>

</div>

</body>

9. Write a PHP script to display Welcome message.


<?php

echo "<p align ='center' size=>Welcome </p>";

?>
• Write a PHP script to demonstrate use of arithmetic operators, comparison operators, and
logical operators.
<?php

$x=16;

$y=12;

echo "Arithmetic Operator :";


echo "<Br>";
echo "x+y=";
echo $x+$y;//8
echo "<Br>";
echo "x-y=";
echo $x-$y;//4
echo "<Br>";
echo "x*y=".$x*$y;//12
echo "<Br>";
echo "x%y=".$x%$y;//0
echo "<Br>";
echo "x/y=".$x/$y;//3
echo "<Br>";
echo $x**$y;//36

echo "<Br>";
echo "<Br>";
echo "<Br>";
echo "Comparison Operator :";
echo "<Br>";

$z="16";
if( $x===$z)
echo "true";
else
echo "false";
echo "<Br>";

$a=2;
$b=6;
echo "<Br>";
echo "<Br>";
echo "Logical operators :";
echo "<Br>";
echo "<Br>";
if($a==21 xor $b==6)
echo "true";
else
echo "false";
echo "<Br>";
if($a!=2)
echo "true";
else
echo "false";
?>
10. Write a PHP script to get type of variable using gettype().
Write a PHP script to set type of variable using settype()

<?php

$a=10;
$b="xyz";
echo "three is simple gettype fuction output here: "."<br>";
echo gettype("datatype of a is :".$a)."<br>";
echo gettype("datatype of b is :".$b)."<br>";
echo "after a change datatype of variable a by useing settype fuction output is here :
"."<br>";
echo settype($a,"string");
echo gettype("datatype of a is :".$a)."<br>";
echo "after a change datatype of variable b by useing settype fuction output is here : "."<br>";
echo settype($b,"float");
echo gettype("datatype of b is :".$b)."<br>";

?>
11. Write a PHP script to set type of variable using type casting.

<?php
$a=12.45;

echo "without type casting:".$a."<br>";

$b=(int)$a;

echo "after type casting :".$b."<br>";

?>

12. Write PHP Script to print Fibonacci series

<?php
$sum1=0;
$sum2=1;
$number=15;

echo"fibonacci series is here :<br>";


echo "$sum1 $sum2";
for($i=2;$i<$number;$i++)
{
$sum3=$sum1+$sum2;
echo "$sum3 ";
$sum1=$sum2;
$sum2=$sum3;
}

?>

• Write PHP Script to calculate total marks of sudent and display grade.

<?php

$a=90;
$b=80;
$c=89;
$d=98;
$tot=$a+$b+$c+$d;
echo "<h1>total marks of four subjects marks :<br>".$tot."</h1>" ;
if($tot>350)
{
echo"<h2>A greade</h2>";
}

else if($tot>250)
{
echo"<h2>B greade</h2>";
}

else if($tot>150)
{
echo "<h2>C greade</h2>";

}
else{
echo "<h2>D greade</h2>";
}

?>

• Write PHP Script to find maximum number out of three given numbers.

<?php

$a=10;
$b=90;
$c=60;

if($a>$b && $a>$c)


echo $a." is max :";
else if ($b>$a && $b>$c)
echo $b." is max :";
else
echo $c." is max :";
?>

13. Write PHP Script using two dimensional arrays such as addition of two 2x2 matrices.

<?php
$x=array
(
array (12,23),
array (12,43)
);
$y=array
(
array (13,33),
array (42,23)
);

echo"1st two dimensional array : <br>";


for($i=0;$i<2;$i++)
{
for($j=0;$j<2;$j++)
{
echo " ".$x[$i][$j];

}
echo"<br>";
}

echo"2nd two dimensional array : <br>";


for($i=0;$i<2;$i++)
{
for($j=0;$j<2;$j++)
{
echo " ".$y[$i][$j];

}
echo"<br>";
}

echo"addition of two matrix is here :<br>";

for($i=0;$i<2;$i++)
{
for($j=0;$j<2;$j++)
{
$c[$i][$j]=$x[$i][$j]+$y[$i][$j];

echo " ".$c[$i][$j];

}
echo"<br>";
}
?>
• Write PHP Script to demonstrate use of associative arrays and for FOR EACH loop execution.

<?php
$name=array('1'=>'JAVA',
'2'=>'DWPD',
'3'=>'CNS',
'4'=>'CMTS');

foreach($name as $values){
echo($values.'<br>');
}
?>

14. Write PHP script Using user defined function

<?php
echo "<h1>set case sensitive :</h1> ";
define("a","bharuch",false);
echo "<br>";
echo "<br>";
echo "shree k j polytechnic ". a;
echo "<br>";
echo"shree k j polytechnic " . A;
echo "<br>";
echo "<br>";

echo "<h1>set case-insensitive :</h1>";


echo "<br>";
echo "<br>";
define("b","shree k j polytechnic ",true);

echo b." bharuch";


echo "<br>";
echo B." bharuch" ;
?>

• Write PHP script to demonstrate use of string function.


<?php

echo chr(99); echo "<br>";

echo ord("vinay");

echo "<br>"; echo ord("o");

echo "<br>";
echo strtoupper("jay"); echo "<Br>";

echo strtolower("prajapati");
echo "<br>"; echo strlen("prajapati jay")."<Br>";

echo "<br>";

echo substr("yout work is very good",0.2);

echo "<br>"; echo substr("nice to meet you",3,4);

echo "<Br>";

echo substr("hello karan how are you", 10);

?>
15. Write PHP script to demonstrate use of date/time functions and Math functions.

<?php
echo date("d/m/y");
echo "<br>";
echo date("D/M/Y");
echo "<br>";
echo date("l-F-y");
echo "<br>";
echo date("d/m/y h :i :s a");
echo "<br>";
echo date("d/m/y h :i :s A");
echo "<br>";
echo date("d/m/y G :i :s A");
echo "<br>";
print_r(getdate());
echo "<br>";
if (checkdate(13, 33, 2011)) {
echo "Date is valid date<br/>";
}
else
{
echo "Date is not valid date<br/>";
}
echo"<br>";
echo time();
echo "<br>";
echo mktime(1,1,1,1,1,2001);
?>
16. Create form using text box, check box, radio button, select, submit button. And display user
inserted value in new PHP page (e.g. student registration/inventory/library form).

<html>
<head>
<title>Login page </title>
</head>
<body>
<form action="loginpostphp.php" method="POST" >
Email : <input type="email" name="name1" size="40" required /><br>
<br>

Username :<input type="text" name="name2" required />


<br>
<br>
Password :<input type="password" name="name3" required />
<br>
<br>
Hobbies:<br>
<br>
<input type="checkbox" name= "green" value="green" checked>Cricket
<br>
<input type="checkbox" name="blue" value="blue">Football
<br>
<input type="checkbox" name="red" value="red" checked>Chess
<br>
<input type = "checkbox" name="white" value="white">Music
<br>
<br>
Select category :&nbsp <br>
<input type = "radio" name="male" checked> Male<br>
<input type="radio" checkbox> Female <br>
<input type="radio" > other
<br>
<br>

Select semester : <select name = "semester" size = "3" multiple = "multiple">


<option value="one">1
</option>
<option value="two">2
</option>
<option value="three">3
</option>
<option value="four">4
</option>
<option value="five">5
</option>
<option value="six" select>6
</option>
</select>
<br>
<br>
<input type="submit" value="Submit" />
</form>
</body>
</html>
<?php
$a=$_POST["name1"];
$b=$_POST["name2"];
$c=$_POST["name3"];
$d=$_POST["green"];
$g=$_POST["male"];
$h=$_POST["semester"];

echo "<h1>welcome user see your info is here : <br></h1>";


echo "<br>";
echo "Email : ". $a;
echo "<br>";
echo "user name : ". $b;
echo "<br>";
echo "password : ". $c;
echo "<br>";
echo "hobbies : ". $d;
echo "<br>";
echo "category : ". $g;
echo "<br>";
echo "semester : ". $h;
?>
17. Write two different PHP script to demonstrate passing variables through a URL.

<?php
$fname="jay";
$lname="prajapati";
?>
<a href="ulrtwo.php?First_name=<?php echo $fname; ?>&last_name=<?php echo $lname; ?>">
Click here to Pass Variable through URL
</a>

Script For ulrtwo.Php File<br>


<?php
echo "First Name : ".$_GET['First_name']."<br>";
echo "Last Name : ".$_GET['last_name'];
?>
• Write two different PHP script to demonstrate passing variables through Hidden Variables.

<html>
<head>
<title>Hidden Variables</title>
</head>
<body align="center">
<form method="post" action="hiddentwo.php">
<input type="hidden" name="fname" value="Jay">
<input type="hidden" name="lname" value="Prajapati">
<h1>click here and see your passing variables through Hidden Variables demo : </h1><br><input
type="submit" name="submit" value="submit">
</form>
</body>
</html>

Script For Retrivehidden.Php File


<br>
<?php
if(isset($_POST['submit']))
{
$fn=$_POST['fname'];
$ln=$_POST['lname'];

echo " name : $fn $ln<br>";

?>

18. Write two different PHP script to demonstrate passing variables with sessions

<html>
<head>
<title>Session Demo</title>
</head>
<form method="post" action="srssiontwo.php">
Enter Your name : <input type="text" name="fname">
Enrollment number : <input type="text" name="ename1">
Email : <input type="email" name="ename2">
<input type="submit" name="submit" value="Create session">
</form>
</html>
<?php
session_start();
if(isset($_POST['submit']))
{
$sr=$_POST['fname'];
$br=$_POST['ename1'];
$er=$_POST['ename2'];
$_SESSION['sr']=$sr;
$_SESSION['br']=$br;
$_SESSION['er']=$er;
//session_start();

echo "Your Name is : ".$_SESSION['sr'];


echo "<br>";
echo "Your Enrollment no is : ".$_SESSION['br'];
echo "<br>";
echo "Your Email is : ".$_SESSION['er'];
}
?>
• Write PHP script to demonstrate passing variables with Cookies.
<?php
setcookie("cname","jay prajapati");
setcookie("Email","[email protected]");
setcookie("age", "18");

?>
<html>

<head>
<title>Set Cookies with PHP</title>
</head>

<body>

<?php echo "Set Cookies"?>


<a href="acccookies1.php">Access your Cookies</a>
</body>

</html>
<html>

<head>
<title>Accessing Cookies with PHP</title>
</head>

<body>

<?php
if(isset($_COOKIE["cname"]) && isset($_COOKIE["age"]) && isset($_COOKIE["Email"])) {
echo "Welcome : <b>".$_COOKIE["cname"]. "</b><br />";
echo "Your email i'd is : <u>".$_COOKIE["Email"]. "</u><br />";

echo "Your age is : <u>".$_COOKIE["age"] . "</u><br />";


}
else
echo "cookies not setted";
?>

</body>
</html>
• Write a program to keep track of how many times a visitor has loaded the page.

<?php

$handle = fopen("counter.txt", "r");

if(!$handle)
{

echo "could not open the file" ;

}
else
{
$counter = (int ) fread($handle,20);
fclose ($handle);
$counter++;
echo" <strong> you are visitor no ". $counter . " </strong> " ;
$handle = fopen("counter.txt", "w" );
fwrite($handle,$counter);
fclose($handle);
}
?>
19. Write a PHP script to connect MYSQL server from your web application.

<?php

$con = mysqli_connect("localhost","root","") ;
$db = mysqli_select_db ($con,"kjdatabasework") ;
$cmd = mysqli_query($con,"create table Test (ID integer, Name
varchar (20))") ;

if ($con)
{
echo "Connected with MySQL <br>" ;
}
else
{
echo "Can not connect with MySQL <br>" ;
}

if ($db)
{
echo "Database Selected Successfully <br>";
}
else
{
echo "Error while selecting the Database <br> " ;
}

?>
20. Write a PHP script to create and drop database.

<?php
$con=mysqli_connect('localhost','root','')or die("dd");
if($con)
{
echo "MYSQL server connected<br><br>";
}
$sql="CREATE DATABASE SrDB";
if($query=mysqli_query($con,$sql))
{
echo "Database created <br><br>";
}

$drop='DROP DATABASE `srdb`';


if(mysqli_query($con,$drop))
{
echo "Database Dropped<br><br>";
}
$close=mysqli_close($con);
if($close)
{
echo "Connection Closed to MYSQL server";
}
?>

21. Create database using phpMyAdmin.


Write a program to read input data, from table and display all these information in tabular
form on output screen.

<?php
$con=mysqli_connect('localhost','root','');
mysqli_select_db($con,"kalash");

//mysqli_query($con,"insert into test values(330702,'PQR','Electrical')");


?>
<html>
<head>
<title>Display From Database</title>
</head>
<table border="12">
<tr>
<th>ID</th><th>NAME</th><th>email</th><th>description</th><th>uid</th>
</tr>
<?php
$sql="SELECT * FROM feedback_master";
$query=mysqli_query($con,$sql);

while($raw=mysqli_fetch_assoc($query))
{
?>
<tr>
<td><?php echo $raw['f_id'] ?></td>
<td><?php echo $raw['user_name'] ?></td>
<td><?php echo $raw['user_email'] ?></td>
<td><?php echo $raw['f_des'] ?></td>
<td><?php echo $raw['user_id'] ?></td>
</tr>
<?php
}
?>
</table>

You might also like