I am sure I just cannot get the syntax correct. I have a table that is populated with names from a database. I want to make it so when the user click the hyperlink uses the link in the database to direct the user to the new page. Once on that new page I will have a query that will populate another list based on the name in the hyperlink that was selected.

Page 1
Team A
Team B

Pate 2
Team B (was clicked)
Player A
Player B
Etc...

The code below works for populating the list and when the user clicks the Team Name it brings them to the new page. However I cannot seem to the hyperlink to pass the team name. I am pretty sure I want to use Get, and if I just use TeamA.php?id=id (pulling recordset) it works great. But I cannot for the life of me figure out the syntax when I am pulling the actual link from the database too.

<?php do { ?>
<td width="650" align="center"><?php echo "<a href=\"http://".$row_Recordset1["Weblink"]."\">".$row_Recordset1["Teams"]."</a>"; ?> 

Thanks!

I know that this thread is a little bit old, hope I could help.

You could use a GET parameter to specify what are you displaying like this:
TeamA.php?do=viewteam&id=$some_team_id

Now, inside "TeamA.php" check for the new parameter and act accordingly, you do something like:

if(@$_GET['do'] == 'viewteam')
{
    $team_id = @$_GET['id'] or die('No team id was specified');
    // fetch players, display some data.
} else
{
    // your code for displaying the team list goes here.
}

Salam

Member Avatar for diafol

You may need to use urlencode() if you're passing text.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.