PDA

View Full Version : Passing and Using a variable on subsequent page



GFX.Wiz
October 20th, 2004, 10:46 AM
OK...this should be a snap for the experienced amongst us (which I am not LOL)...

I am creating an index of links that link to a separate page. On the first page, call it index.php, I am gathering the links by 'select id, title' from the database and it is outputting the result to the same page. So now I have a list of links with an id attached to the title of the link.

I have set up the link to go to a new page by linking the output loop to 'more.php?id=$id' so no problem there. Everything works as expected with the obvious exception that "more.php?id=$id" results in a blank page...as expected. So here's my question...

When one of the links is clicked on index.php (linking TO, say, "more.php?id=the_link_ID") how do I use the 'id' gathered on the index.php page to query the database on the 'more.php' page so I can gather and output the full array of information I have for the link (the id, title, keywords, article, picture and whatever else I have in my table in the DB).

A simplified way to think of this is this message board. On any given page you have a list of topics. When you click on a topic it goes to a new page (I do NOT want to use "$_SERVER['PHP_SELF'];" !!!!) and outputs all the data from the DB related to that thread id.

Does this make sense? LOL I am looking for how to structure the entire query on "more.php" to the DB using the id from the previous page.

I sure appreciate any input!!!

GFX.Wiz
(not a coding wiz)

[m]
October 20th, 2004, 12:19 PM
$id = $_GET['id'];

Digitalosophy
October 20th, 2004, 12:44 PM
"SELECT * FROM TABLENAME WHERE COLUMNAME = $id;"

GFX.Wiz
October 20th, 2004, 01:36 PM
']$id = $_GET['id']; I knew it was something remarkably simple but I didn't know what. I thank you for helping me!!! It works perfect :beer: