<thead>

    <th style="width:2%;text-align:center;">
        <input type="checkbox" name="all" id="all" value=""/>
    </th>

    <?php foreach ($fields as $field_name => $field_display): ?>

        <th>

            <?php echo $field_display; ?>

        </th>

    <?php endforeach; ?>

</thead>