<html xmlns="http://www.w3.org/1999/xhtml"><body onload="init()"><?include("conexion.php");if($_POST['btn_Compare']){foreach($_POST['grupo'] as $value) { $query = "SELECT * FROM tabla WHERE id='$value'"; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { $name = $row['name']; $city = $row['city']; echo "$name - $city<br />";}}}?><script type="text/javascript">var _n=0,_nCh=3; function fc(th){ switch(th.checked){ case true: if(_n>=(_nCh)){ th.checked=false; alert("Puedes seleccionar un maximo de 3 checkboxes");return false; }_n++; break; case false: _n--; break; } }</script><form action="" method="post"> <input name="grupo[]" value="1" onClick="fc(this);" type="checkbox" />Check1<br/> <input name="grupo[]" value="2" onClick="fc(this);" type="checkbox" />Check2<br/> <input name="grupo[]" value="3" onClick="fc(this);" type="checkbox" />Check3<br/> <input name="grupo[]" value="4" onClick="fc(this);" type="checkbox" />Check4<br/> <input name="grupo[]" value="5" onClick="fc(this);" type="checkbox" />Check5<br/> <input name="grupo[]" value="6" onClick="fc(this);" type="checkbox" />Check6<br/> <input name="grupo[]" value="7" onClick="fc(this);" type="checkbox" />Check7<br/> <input type="submit" value="Comparar" name="btn_Compare" /></form><br /><br /><A HREF="<? echo $_SERVER['PHP_SELF']; ?>">Refrescar</A></body></html>