PHP; Pass Session Variable Through href

Is there any way to change the following line so that a session variable carries the data to the next page?

<a href="latest.php?recordID=<?php echo $row_rsttest['apcode']; ?>"><?php echo $row_rsttest['airport']; ?></a>

Need not to display the 'apcode' in the URL.
Who is Participating?
ifp_supportConnect With a Mentor Commented:
You can automatically pass the session ID in all URLS by enabling session.use_trans_sid in your php configuration.

When this is enabled, all your URLS are automatically appended with &PHPSESSID=xxxxxx where xxxxxx is the current session ID.

Although passing the session ID in the URL is no prefered, sometimes it is the best solution. If your script is running in an iframe on a different domain PHP will not be able to use cookies in some browsers, so passing the session ID in the URL is the only way.

Bit more info here
well you can pass the string return by session_id in the url to regenerate session on the other page. But if you save something in session you don't have to pass SID through url, you can start session on the other page, and every $_SESSION will be available :)
Steve BinkCommented:
More to the point, you very much should *not* pass session-related information through the URL.  This is a known security issue and will compromise the integrity of your application.  Use session cookies (see for related configuration items) to pass the SID, and PHP's session handler will take care of variable availability.
Steve BinkCommented:
szewkam actually supplied the method (use PHP's session variables).  My post was for clarification about the dangers of putting the SID in the URL.  
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.