www.tutorialspoint.com Forum Index
Register FAQMemberlistUsergroupsTutorials PointLog in
Reply to topic Page 1 of 1
simple calculator problem
Author Message
Reply with quote
Post simple calculator problem 
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. Sad

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
program.
The options are:
Highest
Lowest
Average
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[0] holds the first number, $list[1] holds the second etc

View user's profile Send private message
Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum