I didn't fully understand how you make the subsequent requests, but there are two simple ways of knowing the initial information.
1. Use hidden form input fields on the pages you show to the users after the first request.
2. Use a cookie to store that information
In both cases you can use the module
CGI to get the hidden form fields or set and read the cookie.