Forum Moderators: coopster

Message Too Old, No Replies

PHP Link Directory

         

wfernley

1:55 pm on Mar 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello. I am trying to build a directory of links on my site. I have it so it will display and organize a set of categories from which the user can choose from.

I am having trouble because they all link to the same listing.php page where a value will be sent saying which category it is and then grab the appropriate links for that category. I seem to be having trouble sending that variable to the listings page. I was curious if I should use a session for this. Or, is there a simpler way of going about it.

Thanks. :)

Wes

mykel79

3:28 pm on Mar 1, 2004 (gmt 0)

10+ Year Member



You can just link to:
listing.php?variable1=value

Then access the variable like this:
$variable1

or
$HTTP_POST_VARS['variable1']

depending on the server settings.

wfernley

3:35 pm on Mar 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ahhh, OK. I had something similar to that but it wasn't working. I had it as $variable1=value. So I should just take out the "$".

I will try that out.

Thanks :)

wfernley

5:19 pm on Mar 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmm. It doesn't seem to be working. I tried both $HTTP_POST_VARS['category'] and $category. This is how I have the link working:

list.php?category=".$q2['id']." - where $q2['id'] is the category id number.

It still doesn't seem to carry the variable and value over. Any other ideas?

Thanks

Wes

jezra

5:50 pm on Mar 1, 2004 (gmt 0)

10+ Year Member



when linking to a PHP page without using a form, I believe the GET method is used. So if your link href is to:

list.php?category=SomeID

Retrieving the info on list.php would be:

$passedID = $_GET['category'];

wfernley

8:38 pm on Mar 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for the post. :)

$_GET did work. It's working great now.

Thanks again :)

Wes

russgri

8:54 pm on Mar 1, 2004 (gmt 0)

10+ Year Member



How about expanding on this.
I want to have a link directory without using Php only.

A link to other tutorial post?

wfernley

2:41 am on Mar 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I just built this directory using php. I don't have any tutorials on building a directory because I just built mine from scrath. I wanted one made purely by me, helps me learn better. :)

You might be able to find one with the various tutorial links on the php.net web site though.

Wes