0% found this document useful (0 votes)
15 views

SodaPDF Converted Arithmetic Operator

This PHP code defines a form that allows users to input two numbers and select an operation, then performs the calculation and displays the result. The form submits to the same PHP file, which uses conditionals to check the selected operation and perform the appropriate calculation.

Uploaded by

My Self
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)
15 views

SodaPDF Converted Arithmetic Operator

This PHP code defines a form that allows users to input two numbers and select an operation, then performs the calculation and displays the result. The form submits to the same PHP file, which uses conditionals to check the selected operation and perform the appropriate calculation.

Uploaded by

My Self
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/ 1

<?

php
$n1 = $_GET['a'];
$n2 = $_GET['b'];
$ch = $_GET['c'];

if($ch==1)
{
$c = $n1 + $n2;
echo"addition is: $c";
}
else if($ch==2)
{
$c = $n1 - $n2;
echo"subtraction is: $c";
}
else if($ch==3)
{
$c = $n1 * $n2;
echo"multiplication is: $c";
}
else if($ch==4)
{
$c = $n1 / $n2;
echo"Division is: $c";

}
?>

<html>
<body bgcolor=pink >
<form action="Arith.php" method= "GET" >
Enter first number : <input type=text name=a ><br>
Enter second number: <input type=text name=b ><br>

Operation::
<input type=radio name=c value=1>Addition.<br>
<input type=radio name=c value=2>Subtraction.<br>
<input type=radio name=c value=3>Multiplication.<br>
<input type=radio name=c value=4>Division.<br>
<input type=submit value=ok> <input type=reset value=clear>
</form>
</body>

</html>

You might also like