                                <?php foreach ($students_in_class as $student_item): ?>
                                <tr onclick="window.location='marksheet.php?student_id=<?php echo $student_item['id']; ?>&class_id=<?php echo $class_id; ?>&session=<?php echo urlencode($session); ?>&exam_type=<?php echo urlencode($exam_type); ?>'">
                                    <td><?php echo htmlspecialchars($student_item['roll_number']); ?></td>
                                    <td><?php echo htmlspecialchars($student_item['first_name'] . ' ' . $student_item['last_name']); ?></td>
                                    <td>
                                        <a href="marksheet.php?student_id=<?php echo $student_item['id']; ?>&class_id=<?php echo $class_id; ?>&session=<?php echo urlencode($session); ?>&exam_type=<?php echo urlencode($exam_type); ?>" class="btn btn-sm btn-primary">
                                            <i class="fas fa-file-alt"></i> মার্কশীট
                                        </a>
                                        <a href="marksheet.php?student_id=<?php echo $student_item['id']; ?>&class_id=<?php echo $class_id; ?>&session=<?php echo urlencode($session); ?>&exam_type=<?php echo urlencode($exam_type); ?>&print=1" class="btn btn-sm btn-outline-primary" target="_blank">
                                            <i class="fas fa-print"></i> প্রিন্ট
                                        </a>
                                    </td>
                                </tr>
                                <?php endforeach; ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        // Auto-submit form when class is selected
        document.getElementById('classSelect').addEventListener('change', function() {
            if (this.value) {
                this.form.submit();
            }
        });
    </script>
</body>
</html>