Hello everyone, I am having a problem working out the php bit for a simple calculator I have to make using radio buttons. I've got the html part a done but i'm stuck with the php script that follows for part b. Can anyone pleeease help me with this? Below is my whole task.
Q1. Simple Calculator
a. Create an html file with a radio buttons to choose options and plus 4 textboxes for entry of
any 4 numbers (whole numbers). The numbers entered into the textboxes are to be posted
to a backend php program. The chosen option should also be posted to the backend php
The options are:
Sort in ascending order (7 marks)
b. Create a php script to receive the selected option and the 4 textbox values. Use if statements to handle the options then perform the appropiate calculation printing out the 4 input numbers plus the result.
The program should first check that numbers have been entered in all textboxes, with an appropriate error message if incorrect.
For highest use the max() PHP function â€“ e.g. max($a,$b,$c) returns the value of the variable
containing the highest number
For lowest use the min() PHP function
For average add the values and divide by 4
For sorting add the values into an array and use the sort function sort() â€“
e.g. $list = array($a,$b,$c) where the variables hold the numbers input
sort($list) sorts in order
$list holds the first number, $list holds the second etc