Hello everyone, my name is Ryan and I am in quite a pickle. I am in a PHP class (if you want to call it that, I've learned more playing on the internet) and I am working on a group project but it would seem that we are all at a stand still. We've had about five different versions of this code now and we cannot get a single one to work. So onto the problem.
From the instructor:
"In this project, you would create a grade distribution table in a web document for students in an MSIS 2203 class. Collect as many student grades as the user wishes to enter and display them in a table format.
Student ID | Grade | Letter Grade
Also display the mean, maximum and minimum scores and their corresponding letter grades as additional information on the webpage."
We tried to do this in a few different ways. However, we think we are onto something, we just can't get past this hurdle.
here is our HTML form:
<html>
<head>
<title> Update Database</title>
</head>
<body>
<form method="post" action = "write.php">
Student ID: <br />
<input type= "text" name = "Student_ID" size = "30" /><br/>
Score: <br />
<input type= "text" name = "Score" size = "30" /><br/>
Grade: <br />
<input type= "text" name = "Grade" size = "30" /><br/>
<input type = "submit" value = "Submit" />
</form>
</body>
</html>
here is our PHP code:
<html>
<head>
<title> Grade Distribution Table</title>
</head>
<h5>MSIS 2203 Grade Distribution Table</h5>
<?php
$Scores=array($_POST['Grades']);
$Explode=explode(",",'$Scores');
$Counter=count($Scores);
$ID=0;
while ($ID<=$Counter)
{
$ID++;
}
if ($Scores<=100 && $Scores>=90)
{
$LetterGrade="A";
}
elseif ($Scores<=89 && $Scores>=80)
{
$LetterGrade="B";
}
elseif ($Scores<=79 && $Scores>=70)
{
$LetterGrade="C";
}
elseif ($Scores<=69 && $Scores>=60)
{
$LetterGrade="D";
}
else
{
$LetterGrade="F";
}
?>
<table width="25%" border="5">
<col align="left" />
<col align="left" />
<col align="right" />
<tr>
<th>Student ID</th>
<th>Scores</th>
<th>Letter Grade</th>
</tr>
<tr>
<td><?php print $ID ?></td>
<td><?php print $Scores?></td>
<td><?php print $LetterGrade ?></td>
</tr>
</table>
<br><br>
<b> The mean test score was:</b>
<?php
function average($Scores) {
return array_sum($Scores) / count($Counter);
}
?>
<br><br>
<b> The maximum test score was:</b>
<?php
Print max($Scores)
?>
<br><br>
<b> The minimum test score was:</b>
<?php
min($Scores)
?>
</body>
</html>
any help you guys could give would be completely awesome. Our instructor has been completely unhelpful from the beginning and we honestly don't know what we are doing.
Thanks in advance.