$roll, 'name' => $name ]; } } fclose($handle); } if (count($students) === 0) { $error = "CSV file does not contain valid student data."; } else { // Save session $_SESSION['teacher_name'] = $teacher_name; $_SESSION['class_name'] = $class_name; $_SESSION['students'] = $students; header("Location: student_list.php"); exit(); } } } ?>