title: HTML: keeping checkbox checked after page refresh
body: <p>I would like to keep the checked boxes to stay checked when the page is refreshed. </p>
  
  <p>Actually my page is not just refreshed, I mean like I have pagination and if I hit the next button the url will change like <code>index.php?page=2</code> </p>
  
  <p>The below code can keep the boxes checked after refreshing page but fails when I click on the next page and the url changes to as the above. </p>
  
  <p>So how do i keep the boxes checked? I have tried putting <code>$_GET['page']</code> on the checkbox but it doesn't work.</p>
  
  <pre><code>&lt;form id="form" method="post" action=""&gt;
              &lt;input type="checkbox" name="s" class="checkbox" &lt;?=(isset($_POST['s'], $_GET['page'])?' checked':'')?&gt;/&gt; Small&lt;br&gt;
  &lt;/form&gt;
  
  &lt;script type="text/javascript"&gt;  
      $(function(){
       $('.checkbox').on('change',function(){
          $('#form').submit();
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>Here is the <code>php</code> part which creates the page id. I have this <code>php</code> code below the above form:</p>
  
  <pre><code>if(isset($_GET['page']))
          {
              $page = $_GET['page'];
          }
          else
          {
              $page = 1;
          }
  
  
          /*
           * Set a few of the basic options for the class, replacing the URL with your own of course
           */
          $options = array(
              'results_per_page'              =&gt; 2,
              'url'                           =&gt; 'index.php?page=*VAR*',
              'db_handle'                     =&gt; $dbh
          );
  </code></pre>