Im trying to pass a value from one php to the next via a link.
I have a database of people & their details in the honour roll. I want to display their names as links. This link will go to the detailedHonourRoll.php file which will show their details when completed. However i will need to pass the primary key of the person to the detailedHonourRoll.php file so that it can re-query the database for the desired person. I am trying to do this using url re-writing as below but cannot re-access the variable at the other end. Is it possible to do this, or to at least get the URL so that i can break it up myself.
The following url is the result of clinking the first link displayed.
http://192.168.1.1/pbr002/PHP/detailedHonourRoll1.php?id=1
i am using php 4.0.4 as far as i can work out from linux
rpm -q php
php4.0.4pl1-9
honourRoll.php
<?
include ("./dbaccess.php");
//contains the getResults() function to return the results
?>
<?php
print"<center>";
print"<TABLE CELLSPACING=\"0\" CELLPADDING=\"3\" BORDER=\"0\">\n";
$sql="SELECT * FROM honour_roll";
$sqlResult = getResults($sql);
while ($row = mysql_fetch_array($sqlResult))
{
$name = $row["name"];
$id = $row["id"];
print"<tr><td>$id</td><td>";
********** this line **********
print"<a href=\"detailedHonourRoll1.php?id=$id\">$name</a>";
*******************************
print"</td></tr>\n";
}
//<a href=\"detailedHonourRoll.php?ida=$id\">
echo "</TABLE>";
print"</center>";
?>
detailedHonourRoll1.php
<?php
$newid=$_GET[$id];
print"<br> \$newid=$newid";
print"<br>";
?>