Now you have learned enough about forms, variables and operators to create your own shipping calculator.
- Expand on the example we did at the beginning of this lesson. We took two numbers from the user with a form and then added them together with PHP to display the result. To build your shipping calculator you will also need to get two numbers from the user (weight and distance), do some math with them, and then display the answer.
- Divide the weight of the package and the shipping distance by 20 and then add them up to calculate the shipping cost. Display the cost along with the weight of the package and the distance in the final PHP page. Try using the
. concatenation operator.
- This time, divide the distance by the weight and then add 5 to get the final shipping cost.
- Lastly, make up your own formula and use the subtraction operator in it somewhere.