Hi all,
I’m working on a PHP script for a roster for a football team site. Basically, the script pulls the players names from a mySQL database, and lists them. When you click on a players name, it’s supposed to take you to a page with their stats. So, so far I have it to where it will pull up the players name, but when you click on their name, for some reason the id of the player does not get passed to the URL. For example, let’s say I click on someone named John Doe with whose id in the database is 1. When you click on it, instead of the URL in the address bar being info.php?id=1 it’s info.php?id=$id So as you can see, it doesn’t seem to be sending the variable to the URL. Here’s the code…
<?php
$query = mysql_query("SELECT id, fname, lname FROM players");
while ($result = mysql_fetch_array($query)) {
$id = $result ['id'];
$fname = $result['fname'];
$lname = $result['lname'];
echo $id;
echo '<a href="info.php?id=$id">';
echo $fname;
echo " ";
echo $lname;
echo '</a><br>';
}
?>
I have it echoing the id up there, just to make sure the id will actually show up. It does, but for some reason it doesn’t show up in the URL.
If someone could please help me with this, it would be GREATLY appreciated!
Thanks!