Hi,
One option is to pass the variable over in the url. Your link in index.php that directs to detail.php would look similar to this:
a href="detail.php?var=$var"
Then on detail.php; use GET to grab the variable.
$var=$_GET['var'];
If you're going to send anything funky in the variable such as special characters use $var=urlencode($var); first to get it browser-friendly.
Then $var=urldecode($var); after your GET statement on detail.php to restore it back to its original form.