当前位置:编程学习 > php >>

php 分页、全选、反选、全不选、批量删除

<?php 
/**
 * 用户管理
 * 2011/8/22
 * kcj
 * 
 * */ 
include "isLogin.php"; 
include "../conn/conn.php"; 
$sql="select * from user"; 
$rst=mysql_query($sql); 
$totalnum=mysql_num_rows($rst); 
$pagesize=5; 
$page=$_GET['page']; 
if($page==''){ 
    $page=1; 

$begin=($page-1)*$pagesize; 
$pagecount=ceil($totalnum/$pagesize); 
?> 
 
 
<html> 
    <head> 
        <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
        <title>无标题文档</title> 
        <meta name="Author" content="kcj" /> 
        <meta name="Keywords" content="php,kcj" /> 
        <link rel="stylesheet" type="text/css" href="style/lampcms.css"> 
        <script src="javascript/common0.js"></script> 
        <script type="text/javascript"> 
          var checkall=document.getElementsByName("dell[]"); 
            function select(){                          //全选  
                for(var $i=0;$i<checkall.length;$i++){ 
                    checkall[$i].checked=true; 
                } 
            } 
            function fanselect(){                        //反选  
                for(var $i=0;$i<checkall.length;$i++){ 
                    if(checkall[$i].checked){ 
                        checkall[$i].checked=false; 
                    }else{ 
                        checkall[$i].checked=true; 
                    } 
                } 
            }          
            function noselect(){                          //全不选  
                for(var $i=0;$i<checkall.length;$i++){ 
                    checkall[$i].checked=false; 
                } 
            } 
         
        </script> 
         
         
    </head> 
    <body> 
        <div id="main"> 
            后台管理->管理用户 
            <form  method="post" action="" onsubmit="return confirm('你确定要删除选中项吗?')"  > 
            <div class="msg-box"> 
                <ul class="viewmess"> 
                    <li class="dark-row"> 
                        <span class="list_width width_font">用户名</span> 
                        <span class="list_width width_font" style="width:200px">备注名</span> 
                        <span class="list_width width_font">注册时间</span> 
                        <span class="list_width width_font">操  作</span> 
                    </li> 
                         <?php 
                          
                         if(isset($_POST['dell'])){       //批量删除  
                            $ids=$_POST['dell']; 
                            $ids=implode(",", $ids);   //implode函数 把数组元素组合为一个字符串。  
             &n

补充:Web开发 , php ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,