Multiple browser tabs and "Back" button with PHP
<p>I'm writing an application that drives execution of configuration commands in multiple routers.
Here is how it's designed:</p>

<pre><code>  Page 1            Page 2            Page 3                                             
+--------+        +--------+        +--------+
|  data  |  PRG   |  data  |  PRG   | steps  |
| enter  |-------&gt;| review |-------&gt;| exec   |---+
|  page  |        |  page  |        | page   |   |
+--------+        +--------+        +--------+   | Ajax
                                        ^        |
                                        |        |
                                        +--------+
</code></pre>

<ol>
<li>A user fills in the form on the first page.</li>
<li>The system fetches more data and displays it for review in another form on the second page.</li>
<li>Configuration steps are executed from the third page using Ajax requests.</li>
</ol>

<p>I handle multiple browser tabs/windows by generating an ID through uniqid() and putting it into a hidden element in a form. The data for each tab/window is stored in <code>$_SESSION[$ID]</code>. Post-Redirect-Get is used to get rid of anoying form resubmissions.</p>

<p>The challenge is that when user hits "Back" button in the browser a new ID is generated. That causes <code>$_SESSION</code> and the web form to be out of sync. I was planing to use sticky forms to make the app work like a wizard but that will require the ID to stay the same for duration of tab/window existence.</p>

<p>Could you help me to find out how I can distinguish "Back" button click from opening a new tab?</p>

<p>Thank You!
PN</p>
