Yellow Jacket
Blue Ridge High School
Yellow Jacket
Home > Web Design > Web I > PHP Calculator

PHP Calculator

Objectives


Tasks

  1. Create a new folder for the calculator files inside your assignments folder.
  2. 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.
  3. 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.
  4. Use a switch to evaluate the operation variable and perform the appropriate computation using the numerical variables.
  5. Display the calculation performed and the answer.
  6. 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.
  7. Design a layout (using CSS) for your page. Note that this must be different from the other layouts you have created.
  8. Create a link to the calculator form on your main index page.
  9. Validate your form and display page.