function table_headings($fields) { $output = ""; $output .= "<tr>"; if (!is_array($fields)) { return $output; } foreach ($fields as $field) { $output .= "<th>"; $output .= format_field_name($field); $output .= "</th>"; } $output .= "</tr>"; return $output; }
<?php include_once '../includes/functions.php'; $view_title = 'home'; if (isset($_GET['view'])) { $view_title = $_GET['view']; if ($view_title == 'home') { redirect_to('.'); } } ?> <div id = "navigation"> <h2><?php echo format_field_name($view_title); ?> </h2> <table> <?php $views = ['home', 'entries', 'accounts', 'accounts_balances']; for ($i = 0; $i < count($views); $i++) { echo "<th><a href=\"index.php?view=" . htmlentities($views[$i]) . "\">" . format_field_name($views[$i]) . "</a></th>"; } ?> </table> </div>