Jump to content

PHP Navigation help


ThEMakeR

Recommended Posts

Hi again,

I have developed some code for a PHP navigation system, similar to a tutorial I recently looked at, but I'm not sure how I make the appropriate cat_x.php page appear when a link, <a href.... </a>, is clicked. The code 'script' I am using is:

Script:
[code]<?php
if ($p == "") {
include "v3/catalogue.php"; }

elseif ($p == "cat_1.php") {
include "v3/cat_1.php"; }

elseif ($p == "cat_2.php") {
include "v3/cat_2.php"; }

elseif ($p == "cat_3.php") {
include "v3/cat_3.php"; }

elseif ($p == "cat_4.php") {
include "v3/cat_4.php"; }

elseif ($p == "cat_5.php") {
include "v3/cat_5.php"; }

else {
include "v3/error.php"; }
?>[/code]

What I need to happen:
I need to be able to click a link on a page called "catalogue.php", have the variable(?) $p select the appropriate cat_x.php page and display its contents, its catalogue items rather, on the page.

How do I get around this??

To help a bit more I am including the full code for my page:
[code]<?php
  include "header.php";
?>

<br />
<div align="center">
<img src="images/cat_img.gif" alt="Martin & D'almeida antique catalogue 2006" />
<br />
<font>Click the desired catalogue link to see those items</font>
<br /><br />
<a href="http://www.manddantiques.com/catalogue.php?p=cat_1.php"><img src="images/cat_1.jpg" alt="Urns and Ornaments catalogue of stock" height="140" width="100" /></a>
<a href="http://www.manddantiques.com/catalogue.php?p=cat_2.php"><img src="images/cat_2.jpg" alt="Carvings and Sculptures catalogue of stock" height="140" width="100" /></a>
<a href="http://www.manddantiques.com/catalogue.php?p=cat_3.php"><img src="images/cat_3.jpg" alt="Garden Statuary catalogue of stock" height="140" width="100" /></a>
<a href="http://www.manddantiques.com/catalogue.php?p=cat_4.php"><img src="images/cat_4.jpg" alt="Decorative Items catalogue of stock" height="140" width="100" /></a>
<a href="http://www.manddantiques.com/catalogue.php?p=cat_5.php"><img src="images/cat_5.jpg" alt="Chimney and Fire Pieces catalogue of stock" height="140" width="100" /></a>
<br />
<a href="http://www.manddantiques.com/catalogue.php?p=cat_1.php">Urns &amp; Ornaments</a>
<a href="http://www.manddantiques.com/catalogue.php?p=cat_2.php">Carvings &amp; Sculptures</a>
<a href="http://www.manddantiques.com/catalogue.php?p=cat_3.php">Garden Statuary</a>
<a href="http://www.manddantiques.com/catalogue.php?p=cat_4.php">Decorative Items</a>
<a href="http://www.manddantiques.com/catalogue.php?p=cat_5.php">Chimney &amp; Fire Pieces</a>
<br /><br />
<font><u>All items are for sale unless otherwise stated</u></font>
</div>

<?php
  include "footer.php";
?>[/code]

Have I gone about it the wrong way?! Please spend a small few minutes helping me if you can, thanks very much to anyone who lends a hand. Its very appreciated!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.