SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jul 2010
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP includes not showing in page

    Hello - I am new to these forums, but I could really use some help with this problem.
    I have a menu that lists a bunch of items (unordered list). I need these items to appear (image and description) inside a specific div on my page, when they are chosen in the menu (clicked).


    The main page code is this :

    Code HTML4Strict:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    	<title>Page Title</title>	
     
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
     
    <link rel="stylesheet" href="style.css" type="text/css" media="screen" />
     
    <script src="menu.js" type="text/javascript"></script>
    </head>
     
    <body>
    <div id="container">
     
        <div id="topBar">
         <div class="innertext"><h1>Retail Display Fittings</h1>
          <img src="images/header1.jpg" />
         </div><!-- close innertext -->
        </div><!-- close topBar --> 
     
      <div id="leftMenu">
    	<?php include_once "menu.php"; ?>
    	  	<script type="text/javascript">
    	  	initSlideDownMenu();
    	  	</script>
      </div><!--close leftMenu -->
     
    	  <div id="mainContent">
      	  <div class="clear"></div>
     
    	   <div id="interiorPages">
    	    <img src="images/showroom1.jpg" />
    <?php include_once "interior.php"; ?>
     
         </div><!-- close interiorPages -->
     
         <div class="clear"> </div>
      </div><!-- close mainContent -->
     
     <?php include_once "footer.php"; ?>	
     
     </div><!-- close container --> -->
    </body>
    </html>



    The code for interior.php (line 34 above) is this:
    Code PHP:
           if(isset($_GET['id']))
             {$id=$_GET['id'];}
     
    	if(isset($_GET['product']))
             {$product=$_GET['product'];}
     
     
    	if(($id == "slatwall") && ($product == "slatwall")) {
    		include_once("slatwallMainContent.php");
    	}
    	else if(($id == "slatwall") && ($product == "1205")) {
    		include_once("1205-plexi-swivel-shoe-displayer.php");
    	}
    	else if(($id == "slatwall") && ($product == "1213")) {
    		include_once("1213-plexi-shoe-shelf.php");
    	}
    	else if(($id == "slatwall") && ($product == "1214")) {
    		include_once("1214-plexi-shoe-shelf.php");
    	}
    	else if(($id == "slatwall") && ($product == "1215")) {
    		include_once("1215-slant-plexi-shoe-shelf.php");
    	}
    	else if(($id == "slatwall") && ($product == "2800")) {
    		include_once("2800-straight-out.php");
    	}
    	else if(($id == "slatwall") && ($product == "2802")) {
    		include_once("2802-waterfall.php");
    	}
     	else if(($id == "slatwall") && ($product == "2804")) {
    		include_once("2804-hangrail-bracket.php");
           }
    and so on...


    the code for the individual interior pages , e.g. 2804-hangrail-bracket.php is what I want displayed in the div:
    Code HTML4Strict:
       <p class="prod_img"><img src="../images/2804t.gif" /></p>
     
    <div class="clear"> </div>
     
       <h1 class="prod_name"> 2804 HANGRAIL BRACKET</h1>
     
       <p class="prod_desc"> 1&quot;&amp;1 1/16&quot;
            round tubing or<br>
            1 1/4&quot; &amp; 1 5/16&quot; round tubing<br>
            chrome only</p>
     
    <div class="clear"> </div>

    ALL the pages are saved as .php files.

    I cannot get the content to show in the div - and I am not getting any error messages, just nothing happens. All the files are in the same folder. And if I right-click on the menu they will open in a new page or tab, but they do not show in the same page in the div when the menu is clicked.

    I hope I have been clear - I am fairly new to PHP and I'm sure there is a silly error somewhere in the code but I can't find it. I've been searching, reading tutorials and forums for over a week now, can't solve this.

    Thanks for any help,

  2. #2
    SitePoint Zealot Cute Tink's Avatar
    Join Date
    Apr 2009
    Posts
    152
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you tried to echo or print the values of $_GET['id'] or $_GET['product'] to make sure they are equivalent to what you are checking for?

    You don't have an ultimate else{} option, so if they don't match what you are looking for, nothing is going to show up.

  3. #3
    SitePoint Member
    Join Date
    Jul 2010
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am pretty sure the content is equivalent, because when I right-click on the menu they will load into a new tab or page - they just don't load into the page where I want them.
    I'll try an echo for an error messasge for empty values and see what i get...


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •