0% found this document useful (0 votes)
23 views5 pages

All Practicals On 5th Chapter

Uploaded by

qrv8bvdm8q
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views5 pages

All Practicals On 5th Chapter

Uploaded by

qrv8bvdm8q
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Practical No:12 Name Of Student:

SOP 1 : Write a PHP program to check if a person is eligible to vote or not.The


program should include the following-
 Minimum age required for vote is 18.
 Use PHP functions.
 Use Decision making statement
Program:- Vote.html
<!DOCTYPE html>
<html>
<head>
<title>Eligible to Vote or not</title>
</head>
<body>
<form method="post" action="vote.php"> Enter your age
<input type="text" name="age"><br><br>
<input type="submit" name="submit" value="CheckEligible">
</form>
</body>
</html>

**********************************************************************
Program:- Vote.php
<?php
if(isset($_POST['submit']))
{
$age=$_POST['age'];
if($age>=18)
echo"<br><h1>Congratulation,You are Eligible for Vote....<h1>";
else
echo"<br><h1>You are not Eligible for Vote....</h1>";
}
?>
Output 1:- Vote.html

Output 2:- Vote.html


Practical No:13 Name Of Student:

SOP 2 : Write a PHP function to count the total number of vowels(a,e,i,o,u) from the
string. Accept a string by using HTML form.

Program:- Vowels.html

<html>
<body>
<h2>String Functions</h2>
<form method="post"action="Vowels.php">
Enter string <input type="text" name="t1"><br><br>
<input type="submit" name="submit" value="count vowels">
</form>
</body>
</html>

Program:- Vowels.php Output:- Vowels.html

<?php
if(isset($_POST['submit']))
{
$str=strtolower($_POST['t1']);
$vowels=array('a','e','i','o','u');
$len=strlen($str);
$num=0; for($i=0;$i<$len;$i++)
{
if(in_array($str[$i],$vowels))
{
$num++;
}
}
echo"Number of vowels are :$num";
}
?>
Practical No:14 Name Of Student:

SOP 6 : Write a program using PHP to calculate Electricity bill by accepting the
limits.
 Forfirst100 units-Rs. 4
 Fornext100 units-Rs. 5
 Fornextallunits-Rs.6
Program:- Bill.html
<html>
<body>
<h2> Electricity Bill </h2>
<form method="post" action="bill.php"> Enter number of units:
<input type="text" name="units"><br><br>
<input type="submit" name="submit" value="Calculate Bill">
</form>
</body>
</html>
Program:- Bill.php
<?php
if(isset($_POST['submit']))
{
$units=($_POST['units']);
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";
}
}
}
?>
Output:- Bill.html

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy