Why does the following code not work?
<html>
<head>
<title>Your class Average</title>
</head>
<body>
<?php
// grade forumla - edit based on number of tests, quizzes, etc.
$grade = "(((($testg1 + $testg2) / 2) 40) + ((($quizg1 + $quizg2 + $quizg3 + $quizg4) / 4) 20) + ((($vocabg1 + $vocabg2 + $vocabg3 + $vocabg4) / 4) 20) + ((($hmwkg1 + $hmwkg2 + $hmwkg3 + $hmwkg4) / 4) 10) + ((($journg1 + $journg2 + $journg3 + $journg4 + $journg5) / 5) * 10)) / 100";
echo "$grade";
//To show the letter grade
if ($grade > 77){
echo "A";
}
else {
echo "Not even at least a C. sorry."
?>
</body>
</html>
$grade comes from this page:
<html>
<head>
<title>Enter your grades</title>
</head>
<body>
<form action="grade.php" method="post">
Test Grade 1: <input type="text" name="testg1">
Test Grade 2: <input type="text" name="testg2"><br><br>
Quiz Grade 1: <input type="text" name="quizg1">
Quiz Grade 2: <input type="text" name="quizg2">
Quiz Grade 3: <input type="text" name="quizg3">
Quiz Grade 4: <input type="text" name="quizg4"><br><br>
Vocab Grade 1: <input type="text" name="vocabg1">
Vocab Grade 2: <input type="text" name="vocabg2">
Vocab Grade 3: <input type="text" name="vocabg3"><br>
Vocab Grade 4: <input type="text" name="vocabg4"><br><br>
HMWK Grade 1: <input type="text" name="hmwkg1">
HMWK Grade 2: <input type="text" name="hmwkg2">
HMWK Grade 3: <input type="text" name="hmwkg3"><br>
HMWK Grade 4: <input type="text" name="hmwkg4"><br><br>
Journal Grade 1: <input type="text" name="journg1">
Journal Grade 2: <input type="text" name="journg2">
Journal Grade 3: <input type="text" name="journg3"><br>
Journal Grade 4: <input type="text" name="journg4">
Journal Grade 5: <input type="text" name="journg5"><br><br>
<input type="submit" value="calculate">
</form>
</body>
</html>