将复选框传播到网格列表视图中

时间:2013-07-22 10:19:29

标签: php html css

我的网站有一个表单,其中有一个位置部分有3个状态,一个选择所有位置复选框,一个县标题,在选择时检查它下面的所有城镇/城市和城镇/城市复选框。这是PHP给你一个更好的主意:

$str = '<input id="chkMaster" onclick="checkAllEnquiryLocation();" type="checkbox" value="AR000" name="location[]" /> <strong>All Locations</strong>'."\n"."<br>";
    $sql = "SELECT location_area_code, location_area_name FROM emg_location_area";
    $rs = $db->query($sql);
    if ($db->get_num_rows($rs))
    {
        while ($row = $db->fetch_row($rs))
        {
            $str .= '<div id="loco-column">';
            $area_Code = $row['location_area_code'];
            $area_Name = $row['location_area_name'];
            $str .= '<input onclick="checkAll_'.$area_Code.'()'.';" id="'.$area_Code.'" type="checkbox" value="'.$area_Code.'" name="location[]" /> <strong>'.$area_Name.'</strong>'."\n"."<br>";
            $xtpl->assign("function_id", $area_Code);

            $sql = "SELECT location_code, location_name 
                    FROM emg_location 
                    WHERE location_area_code='".$row['location_area_code']."'";
            $rs1 = $db->query($sql);
            if ($db->get_num_rows($rs1))
            {
                while ($row1 = $db->fetch_row($rs1))
                {
                    $k = $row1['location_code'];
                    $v = $row1['location_name'];
                    $str .= '<input id="'.$area_Code.'_'.$k.'" type="checkbox" value="'.$k.'" name="location[]" /> '.$v."\n"."<br/>";
                    $xtpl->assign("element_id", $area_Code."_".$k);
                    $xtpl->parse("main.area_check_all.element");
                }
                $xtpl->parse("main.area_check_all");
$str .= '</div>';
            }
        }

我希望这些显示如下:Ebay's grid list view如果您向下滚动页面,您会看到即使某些列表尺寸不同,它们也适合内联并完美填充所选区域。

我认为这很简单,我已经环顾四周,我能看到如何做到这一点的唯一方法就是使用更多的PHP,但是在CSS中有更清晰的方法可以让人知道吗?

继承我对css的尝试,它几乎可以正常工作,但较小的位置列表似乎卡在容器的右侧:

#loco-column{ display:inline-block; max-height:200px; float:left; padding-left:10px; margin-bottom:20px; }

0 个答案:

没有答案