I'm a new beginner. Why are these error messages showing up? I need some assistance with this.
Warning: Undefined variable $totalNumber in C:\xampp\htdocs\Class\ch16\Johnson-calculating.php on line 76
Fatal error: Uncaught ArgumentCountError: fputs() expects at least 2 arguments, 1 given in C:\xampp\htdocs\Class\ch16\Johnson-calculating.php:80 Stack trace: #0 C:\xampp\htdocs\Class\ch16\Johnson-calculating.php(80): fputs('scores1.txt:81....') #1 {main} thrown in C:\xampp\htdocs\Class\ch16\Johnson-calculating.php on line 80
//include functions from Johnson-inc-calc-functions.php file
include ("Johnson-inc-calc-functions.php");
// get the scores from the html file
$fileName = $_POST['scores'];
// Add the code which would read from a file called scoresFile
// and input the score value into the array called scoresArray
$scoresFile = fopen("$fileName", "r");
$scores = fgets($scoresFile);
while (!feof($scoresFile))
{
$scoresArray[] = floatval($scores);
$scores = fgets($scoresFile);
}
fclose($scoresFile);
// call each function and store in a new variable
$average = avgArray($scoresArray);
$highest = highestInArray($scoresArray);
$lowest = lowestInArray($scoresArray);
$numPassing = numPassingArray($scoresArray);
$totalNumber = $totalNumber + sizeof($scoresArray);line 76
$scoresFile = fopen("output.txt", "a");
fputs("$fileName:$average:$highest:$lowest:$numPassing:$totalNumber\n");line 80
fclose($scoresFile); Put the code you need help with here.