Named ancors and variables across pages

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Slippy
Forum Contributor
Posts: 113
Joined: Sat Jul 12, 2003 11:31 pm
Location: Vancouver eh!

Named ancors and variables across pages

Post by Slippy »

I hope this is an easy question for somebody out there.

I am writing an FAQs section for a website. The site has about 300 questions and answers so I don't want to put everything on one page.

I have also put each set of questions into it's own category for ease of use/management ... easy for the user; maybe not so easy for me.

Basically I have 2 pages:
faqs.php <-- lists all of the categories and the questions for each category
-and-
faqscats.php <-- lists all of the questions and answers in the category.

What I want is to used named anchors to reference the links on the next page. Typically this is easy to do.

Code: Select all

// inside faqs.php you would have a link like this:
<a href="faqscats.php#question1">Click here to see #1</a>
So we all know that that would work normally. The problem occurs when I need to load categories. I was thinking that I could just pass in the primary key of the category and rip everything out of the database as follows:

Code: Select all

// inside faqs.php you would have a link like this:
<a href="faqscats.php?c=3#question1">Click here to see #1</a>
The idea is that the faqcats will show only the questions/answers in category "3" and jump straight to question #1 when clicked.

Unfortunately (maybe to a limitation of html or internet exploiter), the server whines and 404's the page which (with my apache config) basically shows them the home page (index.php).

What the heck am I doing wrong? Is there another way to do this?

HELP!!! 8O
User avatar
Slippy
Forum Contributor
Posts: 113
Joined: Sat Jul 12, 2003 11:31 pm
Location: Vancouver eh!

Post by Slippy »

Never mind... apparently I'm a dumbass and I forgot the .php at the end of the file name... kind of hard to load a page that isn't there... hence the 404 ... :oops:
Post Reply