多选框勾选 和 后台数据处理

前台:

<input class="aids" type="checkbox" name="aids[]" value="895">

后台:

public function del()
    {

        $aids = isset($_REQUEST['aids']) ? $_REQUEST['aids'] : false;
//        show_bug($aids);
        if ($aids) {
            if (is_array($aids)) {
                $aids = implode(',', $aids);
                $map['order_id'] = array('in', $aids);
//                show_bug( $map);
            } else {
                $map = 'order_id=' . $aids;
            }
            if (M('order')->where($map)->delete()) {
                addlog('删除查询单,ORDER_ID:' . $aids);
                $this->success('恭喜,查询单删除成功!');
            } else {
                $this->error('参数错误!');
            }
        } else {
            $this->error('参数错误!');
        }

    }
原文地址:https://www.cnblogs.com/raphael1982/p/8350275.html