You are on page 1of 8

PRACTICAL 1

Object: Write a program to create Student Registration


form.
Requirement: Desktop/Laptop, Browser, Notepad, Xampp Server.
Program:
<html>
<body bgcolor="cyan">
<?php
echo "
<h2><center>STUDENT REGISTRATION FORM</center></h2>
<center>
<form action='reg.php' method='post'>
<table>
<tr><td>Name: </td><td><input type='text'
name='name'></td></tr>
<tr><td>Username: </td><td><input type='text'
name='username'></td></tr>
<tr><td>Roll No.: </td><td><input type='text' name='roll
no.'></td></tr>
<tr><td>Fathers Name: </td><td><input type='text'
name='email'></td></tr>
<tr><td>Branch: </td><td><input type='text'
name='email'></td></tr>
<tr><td>College: </td><td><input type='text'
name='email'></td></tr>
<tr><td>Phone Number: </td><td><input type='text'
name='email'></td></tr>
<tr><td>Password: </td><td><input type='text'
name='password'></td></tr>
<tr><td>City: </td><td><input type='text' name='email'></td></tr>
<tr><td><input type='submit'></td></tr>
</form>
</center>
";
?>
</body>
</html>

Output:
PRACTICAL 2
Object: Write a program to perform EB Bill Calculation.
Requirement: Desktop/Laptop, Browser, Notepad, Xampp Server.
Program:
<html>
<head>
<title>Electricity bill calculator</title>
</head>
<body bgcolor="bluegray">
<?php
echo "
<center><h2>EB Calculator</h2></center>
<center><form method='POST'>
<tr><td>Enter Meter Number:
<input type='number' name='num1' value='' placeholder='Enter
Meter Number value'/></td>
Enter Number of Units: </tr>
<tr><td><input type='number' name='unit' value=''
placeholder='Enter unit consume'/></td></tr>
<tr><td>Enter Category: <select name='tariff'>
<option>Select </option>
<option>Rural </option>
<option>Residential </option>
<option>Commercial </option>
</select></td></tr>
<td><input type='submit' name='submit' value='Submit'/></td></tr>
</table>
</form>
<center>
";
if(isset($_POST['submit'])){
$num1=$_POST['num1'];
$unit=$_POST['unit'];
$tariff=$_POST['tariff'];
if($tariff=="Rural"){
if($unit>0&&$unit<=50){
$e=20;
$price=(($unit*.25)+$e);
}
else if($unit>50&&$unit<=100){
$e=20;
$price=(($unit*.55)+$e);
}
else if($unit>100&&unit<=150){
$e=20;
$price=(($unit*0.80)+$e);
}
else if($unit>150&&unit<=250){
$e=20;
$price=(($unit*1.50)+$e);
}
else if($unit>250&&unit<=400){
$e=20;
$price=(($unit*2)+$e);
}
else if($unit>400){
$e=20;
$price=(($unit*2.5)+$e);
}
echo "Your Meter Number is: ".$num1 ."<br>";
echo "Units Are: ".$unit ."<br>";
echo "Extra Charge Are: ".$e . "<br>";
echo "Total $unit Units of Charges: ".$price ."<br>";
}
else if($tariff=="Residential"){
if($unit>0&&$unit<=50){
$e=35;
$price=(($unit*1.35)+$e);
}
else if($unit>50&&$unit<=100){
$e=35;
$price=(($unit*2.15)+$e);
}
else if($unit>100&&unit<=150){
$e=35;
$price=(($unit*3)+$e);
}
else if($unit>150&&unit<=250){
$e=35;
$price=(($unit*3.5)+$e);
}
else if($unit>250&&unit<=400){
$e=35;
$price=(($unit*4)+$e);
}
else if($unit>400){
$e=35;
$price=(($unit*5)+$e);
}
echo "Your Meter Number is: ".$num1 ."<br>";
echo "Units Are: ".$unit ."<br>";
echo "Extra Charge Are: ".$e . "<br>";
echo "Total $unit Units of Charges: ".$price ."<br>";
}
else if($tariff=="Commercial"){
if($unit>0&&$unit<=50){
$e=65;
$price=(($unit*3)+$e);
}
else if($unit>50&&$unit<=100){
$e=65;
$price=(($unit*4.5)+$e);
}
else if($unit>100&&unit<=150){
$e=65;
$price=(($unit*5.5)+$e);
}
else if($unit>150&&unit<=250){
$e=65;
$price=(($unit*6.0)+$e);
}
else if($unit>250&&unit<=400){
$e=65;
$price=(($unit*6.8)+$e);
}
else if($unit>400){
$e=65;
$price=(($unit*7.2)+$e);
}
echo "Your Meter Number is: ".$num1 ."<br>";
echo "Units Are: ".$unit ."<br>";
echo "Extra Charge Are: ".$e . "<br>";
echo "Total $unit Units of Charges: ".$price ."<br>";
}
else{
echo "Invalid Number";
}}
?>

Output:

You might also like