
<!-- partials/standard_table.php -->

<table class="table table-bordered table-striped">
    <thead>
        <tr>
            <!-- Shared headers -->
            <th>#</th>
            <th>School ID</th>
            <th>First Name</th>
            <th>Last Name</th>
            <th>Gender</th>
            <th>Age</th>
            <th>Grade</th>

            <!-- Custom headers -->
            <?php if (!empty($customHeaders)): ?>
                <?php foreach ($customHeaders as $header): ?>
                    <th><?= esc($header) ?></th>
                <?php endforeach; ?>
            <?php endif; ?>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($rows as $i => $row): ?>
            <tr>
                <td><?= $i + 1 ?></td>
                <td><?= esc($row['school_id'] ?? '') ?></td>
                <td><?= esc($row['first_name'] ?? '') ?></td>
                <td><?= esc($row['last_name'] ?? '') ?></td>
                <td><?= esc($row['gender'] ?? '') ?></td>
                <td><?= esc($row['age'] ?? '') ?></td>
                <td><?= esc($row['Grade'] ?? '') ?></td>

                <?php if (!empty($customKeys)): ?>
                    <?php foreach ($customKeys as $key): ?>
                        <td><?= esc($row[$key] ?? '') ?></td>
                    <?php endforeach; ?>
                <?php endif; ?>
            </tr>
        <?php endforeach; ?>
    </tbody>
</table>
