How can PHP be used to dynamically generate forms for each student in a classroom, allowing for individual grading inputs?

To dynamically generate forms for each student in a classroom, we can use PHP to loop through a list of students and create a form for each student with input fields for grading. Each form can submit the grading input for that specific student.

<?php
// List of students
$students = array("Alice", "Bob", "Charlie");

// Loop through each student and generate a form
foreach($students as $student) {
    echo "<form method='post'>";
    echo "<label for='$student'>$student:</label>";
    echo "<input type='text' name='$student' id='$student' />";
    echo "<input type='submit' value='Submit' />";
    echo "</form>";
}
?>