title: How to add new content when a checkbox is clicked?
body: <p>I made a design with ajax, jquery, mysql and checkbox in php. It is like that :  </p>
  
  <p>There is box with checkboxes. And there is another box which is empty. When you checked a checkbox in first box, information about that checkbox will be displayed in empty box. I did it and work good.But when you clicked another checkbox, information about first you clicked dissappear and only current selection is displayed. That is to say, I want to add new selection on old ones. Also how can I delete information in second box when I unchecked a checkbox. Thank you.   </p>
  
  <p>Here is HTML  code : </p>
  
  <pre><code>&lt;div id="first_box"&gt; 
    &lt;label class='checkbox'&gt;
       &lt;input type='checkbox' id=1&gt; 
           First checkbox
    &lt;/label&gt;
    &lt;label class='checkbox'&gt;
       &lt;input type='checkbox' id=2&gt; 
           Second checkbox
    &lt;/label&gt;
    &lt;label class='checkbox'&gt;
       &lt;input type='checkbox' id=3&gt; 
           Third checkbox
    &lt;/label&gt;
  &lt;/div&gt;
  &lt;div id="second_box"&gt; &lt;/div&gt;
  </code></pre>
  
  <p>Here is jquery code :  </p>
  
  <pre><code>$(document).ready(function() {
  
   $("#first_box input:checkbox").change(function() {
  
      if($(this).is(":checked")) { 
  
         $.post("/here/is/url", { strID:$(this).attr("id"), strState:"1" },
          function(data) {
           $("#second_box").html(data);
         });
  
    } else {
        $.ajax({
          url: 'here/is/url/',
          type: 'POST',
          data: { strID:$(this).attr("id"), strState:"0" }
        });
    }
   });    
  
  
  });  
  </code></pre>
  
  <p>Here is the php code for ajax request :  </p>
  
  <pre><code>$strID    = $_POST['strID'];
  $strState = $_POST['strState'];
  
      if ($strState) { //if checkbox is clicked
  
          //I fetch data about checkbox which is clicked
          $infos = $this-&gt;info_model-&gt;get_info_from_checkbox_id($strID);
  
          foreach ($infos as $info) {
              echo "&lt;label class='checkbox'&gt;
                  &lt;input type='checkbox'&gt;".$info-&gt;information .
                  "&lt;/label&gt;"; 
          }
      } else {  // if it is unchecked
  
           // I do not know how to delete 
  
      }
  </code></pre>