Calculation Form (Chapter 6)

Main Lab 5 Page


PHP can allow the creation of dynamic webpages that respond to user input. This page exists as two separate files. One allows the user to choose two numbers and a mathematical operation. The second page displays the results of that operation.

These two files could be integrated into a single file by separating them with a single if statement with the isset function. But apparently we're not doing that for some reason.

Instead, if the results page does not receive two numbers and a mathematical operation, it redirects to the user input form file. Even though it could just display the form within the same file.

The user input is passed from the form file to the results file using the "POST" method. Which operates discreetly, unlike the "GET" method, which adds a query string to the end of a URL.

Value 1:

Value 2:

Calculation:
add
subtract
multiply
divide