Se vuoi comporre un stringa che verrà poi utilizzata in una query :

codice:
select * from tabella where comune in ('pescara','avezzano','chieti')
codice HTML:
<html>
<head>
  <meta charset="utf-8">
  <title>Prova</title>
<script>
 
function handleClick(cb,indice,comune) {
 
 if(cb.checked==true) {
    vettore_comune[indice]="'"+comune+"'";
 }
 
 if(cb.checked==false) {
    vettore_comune[indice]=0;
 }
 
 var my_array = new Array();
 var i = 0;
 for (ind in vettore_comune) {
  if (vettore_comune[ind]!=0) {
  my_array[i] = vettore_comune[ind];
  i++;
 }
 }
 if (my_array.length != 0) {
   // stampa a video la clausola 
   document.getElementById("vettore_comune").textContent  = "("+my_array.join(',')+")";
   document.getElementById("vettore_comune2").textContent = my_array.join(',');  
 }
}
 
</script>
</head>
<body>
<script>
vettore_comune = new Array();
textArray = new Array();
</script>
 
<label for="cb">
<input type="checkbox" name="nome_var_comune[]" class="lista_check" id="0" value="pescara"  onclick="javascript:handleClick(this,'0','pescara');">
<input type="checkbox" name="nome_var_comune[]" class="lista_check" id="1" value="avezzano"  onclick="javascript:handleClick(this,'1','avezzano');">
<input type="checkbox" name="nome_var_comune[]" class="lista_check" id="2" value="chieti"  onclick="javascript:handleClick(this,'2','chieti');">
</label>
<php>
</php>
<p id="vettore_comune"></p>
<p id="vettore_comune2"></p>
</body>
</html>