<div><input type="checkbox" name="channel[]"value="baidu" <?php echo $app['channel']['baidu'] == 1 ? "checked" : ""; ?>>百度</div><div><input type="checkbox" name="channel[]"value="huawei" <?php echo $app['channel']['huawei'] == 1 ? "checked" : ""; ?>>华为</div><div><input type="checkbox" name="channel[]"value="meizu" <?php echo $app['channel']['meizu'] == 1 ? "checked" : ""; ?>>魅族</div><div><input type="checkbox" name="channel[]"value="oppo" <?php echo $app['channel']['oppo'] == 1 ? "checked" : ""; ?>>oppo</div><div><input type="checkbox" name="channel[]"value="sanliuling" <?php echo $app['channel']['sanliuling'] == 1 ? "checked" : ""; ?>>360</div><div><input type="checkbox" name="channel[]"value="sougou" <?php echo $app['channel']['sougou'] == 1 ? "checked" : ""; ?>>搜狗</div><div><input type="checkbox" name="channel[]"value="vivo" <?php echo $app['channel']['vivo'] == 1 ? "checked" : ""; ?>>vivo</div><div><input type="checkbox" name="channel[]"value="wandoujia" <?php echo $app['channel']['wandoujia'] == 1 ? "checked" : ""; ?>>豌豆荚</div><div><input type="checkbox" name="channel[]"value="xiaomi" <?php echo $app['channel']['xiaomi'] == 1 ? "checked" : ""; ?>>小米</div>
name要使用[]
打印看下效果
var_dump($channel);die();
array(3) { [0]=> string(5) "baidu" [1]=> string(6) "huawei" [2]=> string(5) "meizu" }