Home > Web Design > Web I > PHP Calculator

## PHP Calculator

## Objectives

## Tasks

- The general steps and objectives are as follows:
- Create a form to obtain numbers to perform a basic math operation.
- Write a PHP program that uses a switch to perform the correct math operation.
- Display the computation and the calculated value.
- Design a layout for the form and display page.
- Validate pages and check spelling.

- Create a new folder for the calculator files inside your assignments folder.
- Create a form that asks the user to enter two numbers and select a mathematical operation to perform.
- They must be able to add, subtract, multiply, or divide the two numbers.
- A select or radio would be good choices for selecting the mathematical operation.
- On the display page, store the numerical values and the math operation to variables.
- Note that you can use the same page for the form and displaying the answer. The answer should only display if the user submits the form.
- Use a switch to evaluate the operation variable and perform the appropriate computation using the numerical variables.
- Display the calculation performed and the answer.
- Provide the user the option to perform another calculation after displaying the answer.
- If you created a separate form and display page you can insert a link on the display page that returns to the form page.
- Design a layout (using CSS) for your page. Note that this must be different from the other layouts you have created.
- Create a link to the calculator form on your main index page.
- Validate your form and display page.