title: pass form variables using commas
body: <p>i'm having multiple results,which have json data placed in it and i have placed compare button to compare all these results together,on button click it passes the variables in url like  </p>
  
  <p><a href="https://i.stack.imgur.com/OdCgB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OdCgB.png" alt="enter image description here"></a></p>
  
  <pre><code>http://localhost/course/compare_results.php?course_id=1&amp;course_id=2
  </code></pre>
  
  <p>i want my url should pass data as: <code>http://localhost/course/compare_results.php?course_id=1,2</code>.  </p>
  
  <p>**EDIT: Adding Code **
  My Code for ajax call is </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(document).ready(function()
  {
      $(".compare").change(function() {
  if(this.checked) {  
    $('#compare_box').show();
  var check = $(this).val();      
      $.ajax({
          type: 'POST',
          url: 'compare.php',
          dataType : "JSON",
          data:{value : check},
          success: function(data)
          {
              console.log(data);
  
         var output = "&lt;div class='col-md-3 photo-grid' style='float:left'&gt;";
         output += "&lt;div id='course_title' class='well well-sm'&gt;";
         output += "&lt;h4&gt;"+data.title+"&lt;/h4&gt;";
         output+="&lt;textarea class='hidden' id='hidden_title' name='course_title' value=&gt;"+data.title+"&lt;/textarea&gt;";
          output+="&lt;/div&gt;";
          output+="&lt;input type='hidden' id='hidden_id' name='course_id' value="+data.id+"&gt;";
         output+="&lt;/div&gt;";
              $('#result').append(output); 
          }
      });
    }
     else if(!this.checked &amp;&amp; boxes[check]) {
  boxes[check].remove();
  delete boxes[check];
    }
   });
  });
  </code></pre>
  
  <p>  </p>
  
  <p>php code is:  </p>
  
  <pre><code>&lt;div id='compare_box'&gt;
      &lt;form action="compare_results.php" method="GET"&gt;
                  &lt;?php ##include 'compare_template.php'; ?&gt;
  
        &lt;div id='result'&gt;
  
        &lt;/div&gt;
        &lt;button id="compare_submit" type="submit" class="btn btn-primary btn-sm"&gt;compare&lt;/button&gt;
        &lt;/form&gt;
          &lt;/div&gt;
       &lt;div class="col-md-3 photo-grid " style="float:left"&gt; 
  
          &lt;div class="well well-sm"&gt;
  
          &lt;h4&gt;&lt;small&gt;&lt;?php echo $title; ?&gt;&lt;/small&gt;&lt;/h4&gt;
         &lt;/a&gt;
       &lt;br&gt;
       &lt;input type ='checkbox' name="compare" class="compare" value="&lt;?php echo $id;?&gt;"&gt;add to compare
       &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>