Jump to content

array building


crossfuse

Recommended Posts

ok let me show my code before i explain what i'm doing

<html>
<body>
<h2 align ="center">Enter Numbers!</h2>

<form method="number.php" action="post">


#1 <input type="text" size="4" maxlength="7" name="num1"><br>
#2 <input type="text" size="4" maxlength="7" name="num2"><br>
#3 <input type="text" size="4" maxlength="7" name="num3"><br>
#4 <input type="text" size="4" maxlength="7" name="num4"><br>
#5 <input type="text" size="4" maxlength="7" name="num5"><br>
#6 <input type="text" size="4" maxlength="7" name="num6"><br>
#7 <input type="text" size="4" maxlength="7" name="num7"><br>
#8 <input type="text" size="4" maxlength="7" name="num8"><br>

<br><input type="Submit" value="Submit">
<input type="Reset" value="Reset">

</form>
</body>
</html>

 

<?PHP

$numbers[] = '$num1';
$numbers[] = '$num2';
$numbers[] = '$num3';
$numbers[] = '$num4';
$numbers[] = '$num5';
$numbers[] = '$num6';
$numbers[] = '$num7';
$numbers[] = '$num8';



rsort($numbers); 

$big=max($numbers);
$small=min($numbers);

print ("The biggest number is $big, and the smallest number is $small.");




?>

ok well i'm trying to make a form where a user can enter numbers and the numbers come out with the average of the numbers that are typed in. i can't use the array function though because some numbers may not be filled in. i feel like i'm close to building the array, but i still am not doing it right...help??

 

Link to comment
https://forums.phpfreaks.com/topic/155923-array-building/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.