title: Best practices on remembering where the user was on php
body: <p>I would like to have some advice on what could be the best practice to remember where the user was on, on a PHP script.</p>
  
  <p>So we have a PHP app, that has a HTML+Js front, and on that front we're showing a paginated list of projects (via DataTables). When the user clicks on a project, the app loads a new page with the project description. </p>
  
  <p>What we want to achieve is that when the user clicks on the back button of the browser, to be sent exactly where he/she was on the list (exact page and row)</p>
  
  <p>We're using DataTables to list pagination and more, so positioning the user on a specific row isn't the problem.</p>
  
  <p>I came to two approaches:</p>
  
  <ul>
  <li><strong>Cookies</strong> <em>(client-side)</em>: So every time the user changes a page in the DataTable we store a cookie. Whenever the user comes back to the page, we read the cookie and position the user on that specific page/row.</li>
  <li><strong>Sessions</strong> <em>(server-side)</em>: Every time the user lands on the project page, we store a session variable with the project ID. Whenever the user comes back to the projects list, we read the session variable, and produce the javascript needed to jump to the specific page/row where the project is.</li>
  </ul>
  
  <p>PROS/CONS about the above?</p>
  
  <p>Any other idea/recommendation?</p>