prepare($query); $stmt->execute([$school_id, $threshold]); $low_performers = $stmt->fetchAll(PDO::FETCH_ASSOC); if (isset($_POST['send_notifications'])) { $sent_count = 0; $fail_count = 0; $use_ai = isset($_POST['use_ai']); foreach ($low_performers as $learner) { if (empty($learner['parent_email'])) { $fail_count++; continue; } $avg = round($learner['average_percent'], 1); $subject = "Urgent: Academic Progress Report for " . $learner['full_name']; $htmlBody = "
Dear Parent,
This is an automated notification regarding the academic performance of {$learner['full_name']} (ID: {$learner['student_id']}).
The current academic average is {$avg}%, which is below the school's monitoring threshold of {$threshold}%.
We encourage you to log into the Parent Portal using the Student ID to view detailed assessment marks and discuss this with the class teacher.
Best Regards,
School Administration
Notify parents of learners performing below a specific threshold.
| Learner | Grade | Average | Parent Email |
|---|---|---|---|
| No learners found below this threshold. | |||
|
= htmlspecialchars($learner['full_name']) ?>
ID: = htmlspecialchars($learner['student_id']) ?>
|
Grade = htmlspecialchars($learner['grade']) ?> | = round($learner['average_percent'], 1) ?>% | = $learner['parent_email'] ? htmlspecialchars($learner['parent_email']) : 'Missing' ?> |