Question: This is the assignment: Create an HTML form for taking numeric values. Create a PHP script that receives the form data, performs some calculations, formats

This is the assignment:

Create an HTML form for taking numeric values. Create a PHP script that receives the form data, performs some calculations, formats the values, and prints the results. Format a floating point with 2 decimal places and another with 3 decimal places. The HTML is what the calculator should look like, it's the PHP code that I need assistance with.

HTML:

Calculator

Insert your numbers below:

Add:

+

Subrtact:

-

Multiply:

*

Divide:

/

PHP:

Calculate

$num1=$_POST[ 'num1' ];

$num2=$_POST[ 'num2' ];

$a = $num1 + $num2;

print "the sum of number is:" $a;

$num3=$_POST[ 'num3' ];

$num4=$_POST[ 'num4' ];

$b = $num3 - $num4;

print "the sum of number is:" $b;

$num5=$_POST[ 'num5' ];

$num6=$_POST[ 'num6' ];

$c = $num1 * $num2;

print "the sum of number is:" $c;

$num7=$_POST[ 'num7' ];

$num8=$_POST[ 'num8' ];

$d = $num7 / $num8;

print "the sum of number is:" $d;

?>

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!