Diether Posted December 30, 2012 Share Posted December 30, 2012 Hi guys Good day. i want to print the id of navigation links for testing but i dont get any response. Pls help me guys to solve my problem. Thanks in advance content.php <?php require_once("includes/connection.php"); ?> <?php require_once("includes/functions.php");?> <?php include_once("includes/header.php");?> <?php if (isset($_GET['subj'])){ $sel_subj = $_GET['subj']; $sel_page = ""; } elseif (isset($_GET['page'])) { $sel_subj = ""; $sel_page = $_GET['']; }else{ $sel_subj = ""; $sel_page = ""; } ?> <table id = "structure"> <tr> <td id = "navigation"> <ul class ="subjects"> <?php $subject_set = get_all_subjects(); while ($subject = mysql_fetch_array($subject_set)) { echo "<li><a href = \"content.php?subj = ". urlencode($subject["id"]) . "\">{$subject["menu_name"]}</a></li>"; $page_set = get_page_for_subject($subject["id"]); echo "<ul class = \"pages\" >"; while ($page = mysql_fetch_array($page_set)) { echo "<li><a href = \"content.php?page = " . urlencode($page["id"]) . " \">{$page["menu_name"] }</a> </li>"; } echo "</ul>"; } ?> </ul> </td> <td id = "page"> <h2>Content Area</h2> <?php echo $sel_subj; ?></br> <?php echo $sel_page ; ?> </td> </tr> </table> <?php require("includes/footer.php"); ?> functions.php <?php function confirm_query($result_set){ if (!$result_set) { die("Database query failed: " . mysql_error()); } } function get_all_subjects(){ global $connection; $query = "SELECT * FROM subjects ORDER BY position ASC"; $subject_set = mysql_query($query, $connection); confirm_query($subject_set); return $subject_set; } function get_page_for_subject($subject_id){ global $connection; $query = "SELECT * FROM pages WHERE subject_id = {$subject_id} ORDER BY position ASC"; $page_set = mysql_query($query, $connection); confirm_query($page_set); return $page_set; } ?> this is the part of my code that i want to print but no response when click the links <?php if (isset($_GET['subj'])){ $sel_subj = $_GET['subj']; $sel_page = ""; } elseif (isset($_GET['page'])) { $sel_subj = ""; $sel_page = $_GET['']; }else{ $sel_subj = ""; $sel_page = ""; } ?> <?php echo $sel_subj; ?></br> <?php echo $sel_page ; ?> Quote Link to comment https://forums.phpfreaks.com/topic/272516-help-navigation-links-for-testing/ Share on other sites More sharing options...
Diether Posted December 31, 2012 Author Share Posted December 31, 2012 (edited) up for my thread pls help me for my self study Edited December 31, 2012 by Diether Quote Link to comment https://forums.phpfreaks.com/topic/272516-help-navigation-links-for-testing/#findComment-1402279 Share on other sites More sharing options...
Diether Posted March 12, 2013 Author Share Posted March 12, 2013 pls help me guys Quote Link to comment https://forums.phpfreaks.com/topic/272516-help-navigation-links-for-testing/#findComment-1418097 Share on other sites More sharing options...
Diether Posted March 12, 2013 Author Share Posted March 12, 2013 <?php // This block grabs the whole list for viewing $product_list = ""; $sql = mysql_query("SELECT * FROM product ORDER BY date_added DESC"); $productCount = mysql_num_rows($sql); // count the output amount if ($productCount > 0) { $product_list .= "<table><tr><td>Product ID</td><td>Items</td><td>Price</td><td>Date</td><td>Action</td></tr>"; while($row = mysql_fetch_array($sql)){ $id = $row["id"]; $product_name = $row["name"]; $details = $row["details"]; $size = $row["size"]; $price = $row["price"]; $quantity = $row["quantity"]; $date_added = strftime("%b %d, %Y", strtotime($row["date_added"])); $product_list .= "<tr><td>$id</td> <td><strong>$product_name</strong></td> <td>Php$price</td> <td><em>$date_added</em></td> <td><a href='inventory_edit.php?pid=$id'>edit</a> • <a href='inventory_list.php?deleteid=$id'>delete</a><br /></td></tr>"; } } else { $product_list = "<tr><td colspan=5>You have no products listed in your store yet</td></tr>"; } ?> this solves my problem a while ago. hope it can help beginners Quote Link to comment https://forums.phpfreaks.com/topic/272516-help-navigation-links-for-testing/#findComment-1418111 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.