<?php //var_dump($_POST["qy"]); $attr = $_POST["qy"]; $str = implode("','",$attr); //$sql = "select * from House where Area in ('{$str}')"; //echo $sql; ?>
<form action="0509test.php" method="post">
<?php include("DBDA.php"); $db = new DBDA(); $sql = "select distinct Area from housedb"; $arr = $db->Query($sql); //var_dump($arr); foreach($arr as $v) { $v[0]; echo "<input type='checkbox' class='qy' value='{$v[0]}' name='qy[]' />{$v[0]}"; } ?>
<br /> <input type="checkbox" id="qy" onclick="CheckAll()" />全选 <br /> <input type="submit" value="查询" /> </form> </body> <script type="text/javascript"> function CheckAll() { var qx = document.getElementById("qy").checked; var ck = document.getElementsByClassName("qy"); for(var i=0; i<ck.length;i++) { ck[i].checked = qx; } } </script>