Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Oct 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How do you pass parameters from one php page to another

    I apologise if there is already a thread for this but I have been searching around here and in google for a while and can't find the answer to my problem.

    I have a php program http://www.vamosbrigade.com/headtohead2.php

    This contains the following code
    row = mysql_fetch_assoc($tableresult);
    echo "<tr><td class='ResultsTable3c'>";
    echo "<a href=\"http://www.vamosbrigade.com/h2hplayer4.php?player=".$row[PlayerIDFK]."\">".$row['LastName']."</a>, ".$row['FirstName']."</td><td class='ResultsTable6c'>".$row['Wins']."</td><td class='ResultsTable6c'>".$row['Losses']."</td><td class='ResultsTable6c'>".$row['Total']."</td></tr>";
    This means that if you click on the displayed player name you should open a new page that gives the results details for that player

    eg

    http://www.vamosbrigade.com/h2hplayer4.php?player=1

    However that page does not display the player details.

    It contains this code

    $playerresult = DBQuery(" SELECT FirstName, LastName, PlayerIDPK
    FROM Player WHERE Player.PlayerIDPK = '".$player."' ");
    However, nothing happens except the display of the headings.

    It works fine if I hard code the player number into the code so I am assuming the problem is somewhere in the calling string.

    This all worked OK until a recent upgrade to our server so I'm guessing it's a new version of php.

    Can anyone show me where I've gone wrong?

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    You need to use the $_GET global array to receive the values in url, like
    PHP Code:
    $player=$_GET['player']; 
    See http://php.net/register_globals
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New to the CF scene
    Join Date
    Oct 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Fantastic! It works now!

    Thank you so much.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •