HTML & PHP
HTML & PHP
<!doctype html>
<html>
<body>
<h2>List of Indian States with thier capitals</h2>
<ol>
<li>Delhi</li>
<ul><li>New Delhi</li></ul>
<li>Haryana</li>
<ul><li>Chandighard</li></ul>
<li>Gujarat</li>
<ul><li>Gandhinagar</li></ul>
<li>Rajasthan</li>
<ul><li>Jaipur</li></ul>
<li>Maharashtra</li>
<ul><li>Jaipur</li></ul>
<li>Uttarpradesh</li>
<ul><li>Lucknow</li></ul>
</ol>
</body>
</html>
<!doctype html>
<html>
<body>
<h1 align="center"> List of Books</h1>
<table border =1 width=500 height=200 cellspacing=0 align="center">
<tr>
<th rowspan=2> Item Number</th>
<th rowspan=2> Name </th>
<th colspan=2> Price</th>
</tr>
<tr>
<th> RS</th> <th> Paise</th>
</tr>
<tr align="center">
<td> 1 </td> <td> Programming in Python</td><td>500</td><td>50</td>
</tr>
<tr align="center">
<td> 2 </td> <td> Programming in Java</td><td> 345</td><td>00</td>
</tr>
</table>
</body>
</html>
<html>
<head>
<title> A3 </title>
</head>
<body>
<table border=1 width=100% height=100%>
<tr>
<td colspan=2>
<h1> This is a header</h1></td>
</tr>
<tr height=100%>
<td width=30%> Look in the box at the right for some infomation</td>
<td> Here is some infomation</td>
</tr>
<tr>
<td colspan=2> <footer style="font-size:35px;font-weight:bold;"> This is a
footer</footer></td>
</tr>
</table
</body>
</html>
</style>
</head>
<body>
<form action="redistration.php">
<h2> Operating System Information</h2>
Enter your name:<input type="text" name="name"><br><br>
Enter Password:<input type="password" name="password"><br><br>
Which of the following operation system have you used?<br>
<input type="checkbox" name="c1"> LINUX<br>
<input type="checkbox" name="c2"> WINDOWS 10<br>
<input type="checkbox" name="c3"> MACINTOSH 8.0<br>
<br>
Which of the operation system do you like<br>
<input type="radio" name="r1"> LINUX<br>
<input type="radio" name="r1"> WINDOWS 10<br>
<input type="radio" name="r1"> ACINTOSH 8.0<br>
<BR>
You have completed the form <button> Sign up </button>
</form>
</body>
</html>
<!doctype html>
<html>
<head>
<title>B2</title>
<link rel = "stylesheet" href = "b2.css">
</head>
<body>
<h3> Stylized list of elements</h3>
<ul class = "unflowering"><li>Non-Flowering Plants</li>
<ul class = "Flowering">
<li>Fern</li>
<li>Spern</li>
</ul></ul>
<ul><li class = "flowering">Flowering Plants</li>
<ul class = "flowering">
<li>Lily</li>
<li>Rose</li>
<ol class ="types">
<li>Red Rose</li>
<li>Pink Rose</li>
</ol>
</ul></ul>
</body>
</html>
<html>
<body style ="background-color:pink">
<h1 style="font-size:50; color: blue;text-align: center">
PUNE CITY</h1>
<h2 style="font-size:25; color: green">
LANDMARKS IN PUNE</h2><br>
<ol>
<li style="font-size:12; color: red"> Shaniwarvad </li>
<li style="font-size:13; color: voilet"> FC road </li>
<li style="font-size:14; color: orange"> Mg road </li>
<li style="font-size:15; color: brown"> Agarkhan palace </li>
<li style="font-size:16; color: yellow"> NIMB</li>
<ol></br><br>
Assign 3
<BR> </BR>
<BR> </BR>
<BR> </BR>
</body>
</html>
create process.php
<?php
$n1 = $_GET['int1'];
$n2 = $_GET['int2'];
function mod($n1,$n2)
{
return $n1%$n2;
}
function power($n1,$n2)
{
return pow($n1,$n2);
}
function sum($n1)
{
return ($n1 *($n1+1)/2);
}
function fact($n2)
{
$f = 1;
for($i = 1 ; $i <= $n2 ; $i++)
{
$f *= $i;
}
return $f;
}
echo "<br>";
echo "<br>";
FORM
<!doctype html>
<html>
<BR> </BR>
<input type ="radio" name = "option" value = "a"> Find length
<BR> </BR>
<input type ="radio" name = "option" value = "b"> Count vowels
<BR> </BR>
<input type ="radio" name = "option" value = "c"> Convert to lowercase then
to title case
<BR> </BR>
<input type ="radio" name = "option" value = "d"> Pad * on LHS RHS
<BR> </BR>
<input type ="radio" name = "option" value = "e"> Remove leading whitespaces
<BR> </BR>
<input type ="radio" name = "option" value = "f"> Reverse the string
</body>
</html>
P1.php
<?php
require "function.php";
$str = $_GET['s1'];
$option = $_GET['option'];
$l=strlen($str);
switch($option)
{
case 'a' : echo "Length of $str is ".length($str); break;
case 'b' : echo "Count of vowels in $str is ".vowel($str, $l); break;
case 'c' : echo "Case conversion of $str is ".convert($str); break;
case 'd' : echo " Padded string is ".pad($str); break;
case 'e' : echo "Removal of whitespaces ".remove($str); break;
case 'f' : echo "Reversed $str is ".reverse($str); break;
}
?>
FUNCTION
<?php
function length($str)
{
$len = 0;
for($i=0 ; $i<strlen($str) ; $i++)
{
$len++;
}
return $len;
}
return $cnt;
}
function convert($str)
{
return ucwords(strtolower($str));
}
/*function pad($str)
{
return str_pad($str,2,*);
}
*/
function remove($str)
{
return trim($str," ");
}
function reverse($str)
{
return strrev($str);
}
?>
FORM
<!doctype html>
<html>
<body>
<h2> String Operations </h2>
<form action="3B1.php" method="GET">
<BR>
Enter the smaller string : <input type="text" name="smallstr">
</BR>
func3.php
<?php
?>
<?php
require "func3.php";
if($_SERVER['REQUEST_METHOD'] == 'GET')
{
$bigString = $_GET['bigstr'];
$smallString = $_GET['smallstr'];
$operation = $_GET['operation'];
switch($operation)
{
case 'starts' : if(startsWith($bigString , $smallString))
{
echo "Small string appears at the start of big string";
}
else
{
echo "Small string does not appear at the start of the big
string";
}
break;
ASSIGN 4
array 30 temperatures
<?php
$temps=[18,20,22,19,23,25,24,26,27,21,19,18,20,23,24,28,29,26,25,24,22,21,20,27,26,
28,25,22,23,24];
$avg_temp=array_sum($temps)/count($temps);
sort($temps);
$coolest_temp = array_slice($temps,0,5);
$warmest_temp = array_slice($temps,-5);
?>
<!DOCTYPE html>
<html>
<head>
<title>Weather Summary</title>
</head>
<body>
<h2>Weather Summary for the spring month</h2>
<p>Average High Temprature:
<?php
echo number_format($avg_temp,2);
?>
°C
</p>
<p>Five Coolest High Tempratures:
<?php echo implode("°C, ",$coolest_temp);
?>
°c</p>
<p>Five Warmest High Temprature:
<?php echo implode("°C, ",$warmest_temp);
?>
°C
</p>
</body>
</html>
<html>
<body>
<form action ="Array.php" method="POST">
Enter the element you want to insert : <input type="number" name="num"> <br>
Array.php
<?php
$stack = array(1,2,3,4);
$queue = array(11,12,13,14);
if($_SERVER["REQUEST_METHOD"]=="POST")
{
$operation = $_POST["operation"];
$num = $_POST["num"];
switch($operation)
{
case "insert" : array_push($stack, $num);
echo "$num inserted in stack";
print_r($stack);
break;
$myArray = [1,2,3,4,5,6,7];
$newItem = 50;
$position = 3;