Exemple #1
0
">%</label><br>
    <p><input type="submit" value="Find Average of 5 High Scores"></p>
</form>
<?php 
if (count($scores) == 6) {
    rsort($scores, SORT_NUMERIC);
    echo '<h2>Graded Quizzes</h2>';
    for ($arrayIndex = 0; $arrayIndex <= 4; $arrayIndex++) {
        $total += $scores[$arrayIndex];
    }
    $average = number_format($total / 5, 2);
    for ($x = 0; $x <= 4; $x++) {
        echo $scores[$x] . '%';
        echo "<br>";
    }
    echo '<h2>Dropped Score</h2>';
    echo min($scores) . '%' . "<br>";
    echo '<h2>Quiz Average</h2>';
    echo '<p>' . getLetterGrade($average) . '</p>';
} else {
    if (!empty($scores)) {
        ?>
<h3><?php 
        echo "Please enter scores in all textboxes.";
        ?>
</h3><?php 
    }
}
?>
</body>
</html>
        <?php 
foreach ($rows_qUC as $row_qUC) {
    $cname = $row_qUC["cname"];
    $grade = $row_qUC["grade"] == 0 ? "No Grade" : $row_qUC["grade"] . "%";
    ?>
                <tr>
                    <td class="course"><?php 
    echo $cname;
    ?>
</td>
                    <td class="grade"><?php 
    echo $grade;
    ?>
</td>
                    <td class="grade"><?php 
    getLetterGrade($grade);
    ?>
</td>
                </tr>
        <?php 
}
?>
                </table><br/>
                <form method="POST" hidden>
                    <fieldset>
                        <legend>Enter Course</legend>
                        <input type="text" name="cname" placeholder="Course Name" required autocomplete="off" autofocus/><br/>
                        <input style="width: 40px;" type="number" min="0" max="100" name="grade" required/><br/>
                        <input id="formSubmit" type="submit" name="submitCourse" value="Apply"/>
                    </fieldset>
                </form>