Tag Archives: snippet

snippet edition : php html table

<?php 
if(!isset($tbl_header) || !isset($tbl_hasil))
{
?>
<p class="notice">tidak dapat menampilkan hasil query</p>
<?php
}
else
{
?>
   <figure>
         <table>
                <thead>
                        <tr>
                                <?php foreach($tbl_header as $h): ?>
                                <th><?=$h?></th>
                                <?php endforeach;?>
                        </tr>
                </thead>
                <tbody>
                        <?php foreach($tbl_hasil as $row): ?>
                        <tr>
                                <?php foreach($tbl_header as $h): ?>
                                <td><?=$row[$h]?></td>
                                <?php endforeach; ?>
                        </tr>
                        <?php endforeach; ?>
                </tbody>

        </table>
    </figure>
<?php 
}
?>