Trouble with a dynamic link to a dynamic page

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
davidtube
Forum Commoner
Posts: 79
Joined: Sun Mar 25, 2007 8:42 pm

Trouble with a dynamic link to a dynamic page

Post by davidtube »

Hi, I'm new here, please don't hurt me. I've hunted around and can't find the answer


I've got this code which produces a list of links. I'm having trouble working out how to know what link the user has clicked on.

Code: Select all

while ($rows=mysql_fetch_array($modulelist))
{
$_SESSION[module]=$rows[ModuleName];
echo "<a href='lecture.php'>" . $rows[ModuleName] . "</a><br>";
}
With this i hoped I could use $_SESSION on the next page in a query, but unfortunately, $_SESSION only contains the name of the last module on the list no matter which is clicked.

I know i could change the URL but i don't know how to get the variable to read from the URL

I'd really appreciate any help. Thanks :)
User avatar
Skara
Forum Regular
Posts: 703
Joined: Sat Mar 12, 2005 7:13 pm
Location: US

Post by Skara »

I know i could change the URL but i don't know how to get the variable to read from the URL
page.php?somevar=foo

Code: Select all

$blah = $_GET['somevar']
davidtube
Forum Commoner
Posts: 79
Joined: Sun Mar 25, 2007 8:42 pm

Post by davidtube »

:) Thanks it's working now.
Post Reply