title: keep checkbox checked after submitting form
body: <p>Currently I am able to echo the rows from table according to the checked checkbox name attribute using <code>isset</code> in php .</p>
  
  <p>However,  I would like the checkboxes be checked after submitting the form and also if the user <strong>unchecks the checkbox I would like to use the third else statement in the php</strong> where it will retrieve  all rows from the table. How can I achieve this? is it also possible to hide the unchecked box and only show the checked box when a user checks one box. Thanks in advance.</p>
  
  <pre><code>&lt;div&gt; Size
  &lt;form id="form" method="post" action=""&gt;
  &lt;input type="checkbox" name="small" class="checkbox" /&gt; Small
  &lt;input type="checkbox" name="medium"  class="checkbox"&gt;  Medium&lt;br&gt;
  &lt;/form&gt; 
  &lt;/div&gt;
  
  &lt;script type="text/javascript"&gt;  
      $(function(){
       $('.checkbox').on('change',function(){
          $('#form').submit();
          });
      });
  &lt;/script&gt;
  
  &lt;?php
  if (isset($_POST["small"])){
  $paginate = new pagination($page, 'SELECT * FROM pants WHERE size='small' ORDER BY id desc', $options);
  
  }  
  else if (isset($_POST["medium"])){
    $paginate = new pagination($page, 'SELECT * FROM pants where size='medium' ORDER BY id desc', $options);
   }
  else { $paginate = new pagination($page, 'SELECT * FROM pants ORDER BY id desc', $options);
  
  }
   ?&gt;
  </code></pre>