PHP_finalpracts
PHP_finalpracts
Filename: age.html
<html>
<head>
<title>sop1</title>
</head>
<body>
<h1 align="center">Person Eligible to vote or not</h1>
<form name="f1" method="post" action="age.php">
Enter your age<input type="text" name="t1">
<br>
<br>
<input type="submit" name="b1" value="check eligible">
</form>
</body>
</html>
<?php
if(isset($_POST['b1']))
{
$age=$_POST['t1'];
if($age>=18)
echo" you are eligible to vote"
else
echo "you are not eligible to vote"
}
?>
PRACTICAL NO : 13 (SOP6)
Filename: bill.html
<html>
<head>
<title>sop6</title>
</head>
<body>
<h1 align="center">Electricity bill</h1>
<form name="f1" method="post" action="bill.php">
Enter number of limits
<input typ="text" name="t1">
<br><br>
<input type="submit" name="b1" value="calculate bill">
</form>
</body>
</body>
</html>
Bill.php
<?php
if(isset($_POST['b1']))
{
$units=($_POST['t1']);
if($units<=100)
{
$b=$units*4;
echo"your bill amount is :$b";
}
else
{
if($units<=200)
{
$b=400+($units-100)*5;
echo"your bill amount is :$b";
}
else
{
$b=400+500+($units-200)*6;
echo"your bill amount is : $b";
}
}
}
?>
PRACTICAL NO : 14(SOP4)
AIM: PHP CODE TO SAVE MARKS IN AN ARRAY AND DISPLAY MARKS,TOTAL AND PERCENTAGE.
Filename: marks.php
<?php
$m=array('english'=>56,
'hindi'=>76,
'marathi'=>56,
'maths'=>68,
'IT'=>69);
$total=$m['english']+$m['hindi']+$m['marathi']+$m['maths']+$m['IT'];
$percentage=$total/5;
echo"<br>Marks in IT :".$m['IT'];
echo"<br>total :".$total;
echo"<br>percentage:".$percentage;
?>
OUTPUT
PRACTICAL NO: 12
PRACTICAL NO : 13
Practical no 14: