hriti 0 Light Poster

hello
i have a problem
if anyone can solve it please help me...
i have a page from which i get type on left side of page from refrence page...and when i click any one of the reference it shows list on same page regarding to that reference
when i click on particular reference it will go to next page.. on next page i want same refrences on left side according to type...
my problem is it shows all the references in table

my code for reference page is:

<?php include("include/connection.inc.php");
session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Lumex LED Lights</title>

<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'></script>
<link href="css/default.css" rel="stylesheet" type="text/css" />
<link href="css/styles.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="container" align="center">
<div id="wrapper" align="center">
<div align="center"><img src="images/wrappertop.png" width="1004" height="19" /></div>
<div class="CL"></div>
<div class="logo lfloat"><img src="images/logo.png" /></div><div class="search rfloat">
 <script>
  (function() {
    var cx = '013580470917512101672:0ssj6ajuova';
    var gcse = document.createElement('script');
    gcse.type = 'text/javascript';
    gcse.async = true;
    gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
        '//www.google.com/cse/cse.js?cx=' + cx;
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(gcse, s);
  })();
</script>
<gcse:search></gcse:search>
</div>
<div class="CL" style="height:40px; background:url(images/head_seperator.png) center bottom repeat-x; width:996px;"></div>

<div id="nav"><div class="nav lfloat" align="left">
<ul><li style="width:80px;" ><a href="index.php"><img src="images/home_icon.png" border="0" /></a></li><li><img src="images/nav_seperator.png" /></li><li style="width:110px;"><a href="profile.php">Company Profile</a></li><li><img src="images/nav_seperator.png" /></li><li style="width:150px;"><a href="lighting_fundamentals.php">Lighting Fundamentals</a></li><li><img src="images/nav_seperator.png" /></li><li style="width:110px;"><a href="products.php">Products</a></li><li><img src="images/nav_seperator.png" /></li><li style="width:110px;"><a href="references.php">References</a></li><li><img src="images/nav_seperator.png" /></li><li style="width:110px;"><a href="#">Contact Us</a></li></ul>
</div>
</div>
<div class="CL"></div>

<div class="sidebarpanel lfloat">
<div id='cssmenu' class="lfloat">
 <?php $q="SELECT * FROM ref_type ORDER BY id";
        $output=mysql_query($q) or die (mysql_error().$q);
          while ($rows=mysql_fetch_array($output)){
          ?>  
<ul>
   <li><a href='references.php?post_id=<?php echo $rows['id'];?>'><span><?php echo $rows['ref_type'];?></span></a></li>
   </ul>
   <?php } ?>
</div>
</div>
<div class="fundamentalsarea lfloat">
<?php 
$post_id=$_GET['post_id'];
$q="SELECT * FROM ref_type where id='$post_id' ORDER BY id";
        $output=mysql_query($q) or die (mysql_error().$q);
          while ($rows=mysql_fetch_array($output)){
          ?>  
<div class="producthead lfloat"><?php echo $rows['ref_type'];?></div>
<?php } ?>
<div class="CL"></div>
<div class="productlistbase lfloat effect6">
<div class="referencetopic lfloat">
<?php 
$post_id=$_GET['post_id'];
$q="SELECT * FROM refrences where ref_type='$post_id' ORDER BY id";
        $output=mysql_query($q) or die (mysql_error().$q);
          while ($rows=mysql_fetch_array($output)){
          ?>
<ul>
<li><a href='reference_topic.php?p_id=<?php echo $rows['id'];?>'><?php echo $rows['title'];?></a></li>
</ul>
<?php } ?>
</div>
</div>
</div>
<div class="CL" style="height:40px;"></div>

<div align="center"><img src="images/wrapperfooter.png" /></div>
</div>
<div class="CL" style="height:40px;"></div>
<div class="footer">Copyright &copy; 2013-14, Lumax Red Lights. All Rights Reserved.</div>
</div>
</body>
</html>

and for refrence_topic.php is:

<?php include("include/connection.inc.php");
session_start();?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Lumex LED Lights</title>

<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'></script>
<link href="css/default.css" rel="stylesheet" type="text/css" />
<link href="css/styles.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="container" align="center">
<div id="wrapper" align="center">
<div align="center"><img src="images/wrappertop.png" width="1004" height="19" /></div>
<div class="CL"></div>
<div class="logo lfloat"><img src="images/logo.png" /></div><div class="search rfloat">
  <form id="form1" name="form1" method="post" action="">
    <div class="lfloat"><label for="textfield"></label>
    <input name="textfield" type="text" class="searchfield" id="textfield" onclick="this.value='';" value="Search your Keyword" /></div><div style="position:relative; float:left; left:2px; margin:4px;">
    <input type="image" src="images/search_button.png" name="button" id="button" value="Submit" style="margin:0px;" /></div>
  </form>
</div>
<div class="CL" style="height:40px; background:url(images/head_seperator.png) center bottom repeat-x; width:996px;"></div>


<div id="nav"><div class="nav lfloat" align="left">
<ul><li style="width:80px;" ><a href="index.php"><img src="images/home_icon.png" border="0" /></a></li><li><img src="images/nav_seperator.png" /></li><li style="width:110px;"><a href="profile.php">Company Profile</a></li><li><img src="images/nav_seperator.png" /></li><li style="width:150px;"><a href="lighting_fundamentals.php">Lighting Fundamentals</a></li><li><img src="images/nav_seperator.png" /></li><li style="width:110px;"><a href="products.php">Products</a></li><li><img src="images/nav_seperator.png" /></li><li style="width:110px;"><a href="references.php">References</a></li><li><img src="images/nav_seperator.png" /></li><li style="width:110px;"><a href="#">Contact Us</a></li></ul>
</div>
</div>
<div class="CL"></div>

<div class="sidebarpanel lfloat">
<div id='cssmenu' class="lfloat">
<?php  $post_id=$_GET['post_id'];
        $q="SELECT * FROM refrences where id='$post_id' ORDER BY id";
        $output=mysql_query($q) or die (mysql_error().$q);
        while ($row=mysql_fetch_array($output)){
          ?>

<ul>
   <li><a href='reference_topic.php?p_id=<?php echo $row['id'];?>&post_id=<?php echo $post_id;?>'><?php echo $row['title'];?></a></li>
  </ul>
  <?php } ?>
</div>
</div>

<div class=" productrightpanel lfloat">

<div class="producthead lfloat">Projects</div>

<div class="CL" style="height:20px;"></div>
<?php  $p_id=$_GET['p_id'];
        $q="select * from refrences WHERE id = '$p_id' ORDER BY id";
        $output=mysql_query($q) or die (mysql_error().$q);
        while($rows=mysql_fetch_array($output)){
          ?>
<div class=" productname lfloat"><?php echo $rows['title'];?></div>
<div class="CL"></div>
<div class=" productsubdetails lfloat"><?php echo $rows['detail'];?></div>
<?php } ?>
</div>


<div class="CL" style="height:40px;"></div>

<div align="center"><img src="images/wrapperfooter.png" /></div>
</div>
<div class="CL" style="height:40px;"></div>
<div class="footer">Copyright &copy; 2013-14, Lumax Red Lights. All Rights Reserved.</div>
</div>
</body>
</html>

please help me if anyone understand my problem...
thanks in advance...

Dani AI

Generated

Short diagnosis and the likely cause (for ): the detail page does not know which reference type it should show in the left column. That happens when the link from the list page only sends the item id (the individual reference) but not the parent type id, or when the detail page filters using the wrong column/parameter. Either mismatch will make the sidebar query return the wrong set (or everything).

Concrete, non-copy fixes to apply

  • When you build the link from the list to the topic page, include both IDs in the URL (the reference id and the type id). The topic page needs the type id to filter the left menu.
  • On the topic page read both GET values, validate them (cast to integer or validate as numeric), then use the type id to run the sidebar query (filter by the type column) and the item id to fetch the detail. Keep parameter names consistent (avoid mixing post_id and p_id semantics — pick e.g. type_id and ref_id).

Security and quality notes

  • Stop using deprecated mysql_* calls; migrate to mysqli or PDO and use prepared statements to avoid SQL injection.
  • Escape HTML output for the page to avoid XSS.
  • Add simple fallbacks: if the type id is missing, show a message or redirect back to the list page instead of running an unfiltered query.

Debugging checklist

  • Inspect the generated link in the browser (view HTML) to confirm both parameters are present.
  • Temporarily dump $_GET to see what arrived.
  • Log or echo the final WHERE clause (during testing) to verify you are filtering by the type column.
  • Verify table/column spellings (typos in names are a common cause).

Following those steps will make the left column on the topic page show only references for the selected type and avoid the “shows all references” behavior.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.