I tried putting global in various places, but have not had any luck.
Here is the HTML code to complete the story...
Any other ideas out there.
So I still need help. As I state in the above post - most everything works except two problem areas I'm having. One with an array, and the other, a function.
How do I get an array to work with this form
I need to have an array return some data. (see bolded area)
- return Max: Done
- return Min: Done
- return Count: Done
- **** I cannot get the array (the way I have it set up) to do a sort. I need to accomplish this so I can return the 3 highest values, and then the 3 lowest values.
PLease help!
Thanks.
[PHP
<?php
error_reporting (E_ERROR | E_WARNING |E_PARSE);
if ( $GET ['op'] == "add" ) { echo $GET ['number1'] ." + ". $GET ['number2'] ." = "; echo "<b>".($GET ['number1'] + $_GET ['number2']) ."</b>";
}
if ( $GET ['op'] == "sub" ) { echo $GET ['number1'] ." - ". $GET ['number2'] ." = "; echo "<b>". ($GET ['number1'] - $_GET ['number2'])."</b>" ;
}
if ( $GET ['op'] == "mul" ) { echo $GET ['number1'] ." ". $GET ['number2'] ." = "; echo "<b>".($GET ['number1'] $_GET ['number2'])."</b>";
}
if ( $GET ['op'] == "div" ) { echo $GET ['number1'] ." / ". $GET ['number2'] ." = "; echo "<b>". ($GET ['number1'] / $_GET ['number2'])."</b>";
}
echo "You have entered<b> ".count($addingArray)." </b>values.<br>";
echo "This is the <b>Highest</b> Number: ". "<b>". Max($addingArray). "</b><br>";
echo "This is the <b>Lowest</b> Number: ". "<b>". Min($addingArray). "</b><br>";
//for($i= 0; $i < 10; $i++);
$addingArray[0] = $GET ['number1'];
$addingArray[1] = $GET ['number2'];
echo sort($addingArray) ."<br>";
function myAverage(){
print ( $GET ['number1'] + $GET ['number2']) / count($addingArray);
}
myAverage();
function say_hi() {
print "Hi there!"."<br>";
}
say_hi();
?>
[/code]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<form method="get" action="basicAction.php">
Enter Number <input type="text" name="number1"><br>
Enter Number <input type="text"
name="number2"><br><br>
<b>Choose the operation</b><br><br>
<input type="radio" name="op" value="add" checked>
Addition<br> <input type="radio" name="op" value="sub">
Subtraction<br> <input type="radio" name="op" value="mul">
Multiplication<br> <input type="radio" name="op" value="div">
Division<br> <input type="submit" name="Submit"
value="Submit">
</form>
</body>
</html>