/** * retrieve subject name for edit page, page can change to different subject * @return HTML */ public static function find_page_belong_subject() { global $dbo; global $current_page; $subject_set = subject::find_all_subjects(false); $output = ""; while ($subject = $dbo->fetch_assoc($subject_set)) { $output .= "<option value=\"{$subject["id"]}\""; if ($subject["id"] == $current_page["subject_id"]) { $output .= "selected"; } $output .= ">{$subject["menu_name"]}</option>"; } return $output; }
echo " "; echo " "; echo "<a href=logout.php>Log out</a>"; echo "<br />"; echo "<br />"; } else { include "../includes/layouts/login_form.php"; } ?> </div> <div > <?php $subject_set = subject::find_all_subjects(); ?> <?php // 3. Use returned data (if any) while ($subject = $dbo->fetch_assoc($subject_set)) { ?> <a href="index.php?subject=<?php echo urlencode($subject["id"]); ?> "><?php echo htmlentities($subject["menu_name"]); ?> </a> <?php