php下拉选项的批量操作的实现代码

<?php
echo<<<EOT
<form action=”” method=get>
 <select name=”listVar[]” multiple=”multiple” size=3>
  <option>first</option>
  <option>second</option>
  <option>three</option>
  <option>four</option>
  <option>five</option>
 </select>
 <input type=submit value=提交 name=submit>
</form>
mgm娱乐场,EOT;
/*输出GET到的值(数组)*/
if (isset ($_GET[“submit”])) {
 foreach($_GET[“listVar”] as $value){
  echo $value.”<br>”;
 }
}
?>

<div class=”fixsel”>
          <input type=”checkbox” name=”chkall” id=”chkall”
onclick=”checkAll(this.form, ‘id’)” />
          <label for=”chkall”>全选</label>
          <select name=”command”>
            <option>选择操作</option>
            <option value=”adDelete”>删除</option>
            <option value=”adVerify”>显示</option>
            <option value=”adUnVerify”>隐藏</option>
          </select>
          <input id=”submit_maskall” class=”button confirmSubmit”
type=”submit” value=”提交” name=”maskall” />
        </div>

复制代码 代码如下:

复制代码 代码如下:

就使用一个简单的可多选的select:

        switch ($command) {

父类的删除函数:

复制代码 代码如下:

    }

mgm娱乐场 1

protected function _delete ($model = null, $id = ”, $redirect =
‘index’, $attach = null, $pkField = ‘id’)
    {
        if ($attach) {          //如果有附件要删除广告的图片
            $data = $model->findAll($pkField . ‘ IN(:id)’, array
(‘:id’ => $id ));
            foreach ((array) $data as $row) {
                foreach ((array) $attach as $value) {
                    if (! empty($row[$value])) {
                        @unlink($row[$value]);
                    }
                }
            }
        }
        $result = $model->deleteAll(array (‘condition’ => ‘id IN(‘
. $id . ‘)’ ));
        //刷新缓存
        self::_refreshCache($model);
        $this->redirect($redirect);
    }

复制代码 代码如下:

<td ><input type=”checkbox” name=”id[]” value=”<?php echo
$row->id?>”>
        <?php echo $row->id?></td>

复制代码 代码如下:

相关文章