This is a very difficult problem to describe.
The big picture: An ajaxed dialog submits to a page to create a new Content Set record. After creation of the Content Set record, this newly created Content Set should be the selected content set, and all Content that is created or modified needs to have the newly created Content Set id attached. The Content Set id is created using an auto increment field in MySQL during page load.
Problem details: I have a page that uses ajax to pull up a Content Set creation dialog. The dialog submits to a blank URL, because it may be called from more than one location, and I want the dialog to submit to whatever url it was called from. After the dialog submits to the page it was called from, some PHP on the page creates a Content Set record in the MySQL database. I need the newly created record's insert id to be passed from page to page using a GET variable (easiest method since I already pass pagination variables this way), but since the page has to load before I can get the insert id, I have no way of populating all of the places that the GET variable needs to inhabit (on page links, php $_GET variable, the url).
Some things to consider:
Is there any sort of elegant solution to this? This problem may be very unique due to the way the website is set up, but someone has to have dealt with something similar. I am hoping not to have to alter the site design too much in order to solve this one little issue. Any ideas are welcome.
I would have to agree with a session based solution here. Keep in mind that you should be able to create a mechanism to revert back to the old value if the users hits back. For this you would need three sessions variables one with the current value of the id, one with the previous value of the id and one that holds the url of the last page you were on. This way you should be able to check whether a user has hit the back button by checking if the current url is equal to the last url stored in your session variable and if so revert back to the old id.
Please note that this is just a general concept and I am sure you will come across some technical issues that need figuring out before a system like this works properly.