This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA
process.php This script demonstrates using values which were passed in an array.
\n"; $sum += $vals[$i]; } echo "
The sum of those three numbers is $sum.\n";
?>
The first PHP script should generate a form which allows the user to input 10 numbers. 1) When the forms submit button is pressed, the 10 numbers should be sent to the second PHP script as an array.
New coding for display 10 numbers
$max) { $max = $vals[$i]; } if($vals[$i] < $min) { $min = $vals[$i]; } echo "Value $i: $vals[$i].
\n"; $sum += $vals[$i]; // calculate total sum $avg = $sum/10; // calculate average } // Display output echo "
The sum of those 10 numbers is $sum.\n"; echo "
The average of those 10 numbers is $avg.\n";
echo "
The largest of those 10 numbers is $max.\n"; echo "
The smallest of those 10 numbers is $min.\n"; ?>
View in http://localhost/xampp/lisa/process.php