6 Years
Discussion Span
Last Post by broj1

You can try something like this:

   echo "<a href=test.php?varname=$_SESSION['SESSIONVARNAME']>$pname</a>";

To use session mechanism start each script with:


Store the link in the $_SESSION array from the while loop this way:

$_SESSION['link'][] = "<a href=test.php>$pid</a>";

You can also use $pid as an index for the array:

$_SESSION['link'][$pid] = "<a href=test.php>$pid</a>";

Then in the test.php page just use the array $_SESSION['link'] the way you wish.

But be aware of the server memory use. Like if you retrieve 100.000 records you will create an array with 100.000 elements in the session array which will probably be not good. In that case it is better to read the records from the database in the test.php page.

Another remark: the value for the href attribute should be in quotes so better change it like this (i used double quotes which have to be escaped):

$_SESSION['link'][] = "<a href=\"test.php\">$pid</a>";
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.