Introduction to...LOGIN

Introduction to the modules of the website backend - content management

What should we do after the backend user information management and classification management are completed? You have to think about where the information is displayed at the front desk, and then you have to think about content management in the backend. This section will introduce to you how to write content management.

First create a database: newbook

Then create a newbook.php under admin, the code is as follows:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="style/css/pintuer.css">
<link rel="stylesheet" href="style/css/admin.css">
<script src="style/js/jquery.js"></script>
<script src="style/js/pintuer.js"></script>
</head>
<body>
<form method="post" action="" id="listform">
  <div class="panel admin-panel">
    <div><strong> 新书列表</strong></div>
    <!-- <div class="padding border-bottom">
      <ul style="padding-left:10px;">
        <li> <a class="button border-main icon-plus-square-o" href="page.html"> 内容</a> </li>
       
          <input type="text" placeholder="请输入搜索关键字" name="keywords" style="width:250px; line-height:17px;display:inline-block" />
          <a href="javascript:void(0)" class="button border-main icon-search" onclick="changesearch()" > 搜索</a></li>
      </ul>
    </div> -->
    <table class="table table-hover text-center">
      <tr>
        <th width="100" style="text-align:left; padding-left:20px;">ID</th>
        <th width="10%">新书名</th>
        <th>图片</th>
        <th width="30%">作者</th>
        <th >简介</th>
        <th width="310">操作</th>
      </tr>
      <?php
          
            foreach ($data as $v){
      ?>
       
        <tr>
        <td style="text-align:left; padding-left:20px;"><input type="checkbox" name="id" value="ar" />
           <?php echo $v['id']?></td>
          <td><?php echo $v['bookname']?></td>
          <td width="10%"><img src="<?php echo $v['images']?>" alt="" width="70" height="50" /></td>
          <td><?php echo $v['author']?></td>
          <td><?php echo $v['introduction']?></td>
          
          <td>
          <div> 
          <a class="button border-main" href="edit.php<?php echo '?id='.$v['id']?>"><span></span> 修改</a> 
          <a class="button border-red" href="delete.php<?php echo '?id='.$v['id']?>" onclick="return del(1,1,1)"><span></span> 删除</a> 
          </div>
          </td>
        </tr>
        <?php
             }
        ?>
        
        <td style="text-align:left; padding:19px 0;padding-left:20px;"><input type="checkbox" id="checkall"/>
          全选 </td>
        <td colspan="7" style="text-align:left;padding-left:20px;"><a href="javascript:void(0)" class="button border-red icon-trash-o" style="padding:5px 15px;" onclick="DelSelect()"> 删除</a> 
          
         </td>
    
      <tr>
        <td colspan="8"><div>
        <a href="newbook.php?p=1">首页</a> 
        <a href="newbook.php?p=<?php if(!$_GET){echo 1;}else{ if($_GET['p']==1){echo $_GET['p'];}else{echo $_GET['p']-1;}}?>">上一页</a><?php for($i=1;$i<$count+1;$i++){echo "<a href='newbook.php?p=$i'>$i</a>";}; ?>
        <a href="newbook.php?p=<?php if(!$_GET){echo ceil($count);}else{ if($_GET['p']==ceil($count)){echo $_GET['p'];}
        else{echo ceil($_GET['p'])+1;}}?>">下一页</a>
        <a href="newbook.php?p=<?php echo ceil($count);?>">尾页</a>
        </div>
        </td>
      </tr>
    </table>
  </div>
</form>
<script type="text/javascript">
//搜索
function changesearch(){  
    
}
//单个删除
function del(id,mid,iscid){
  if(confirm("您确定要删除吗?")){
    
  }
}
//全选
$("#checkall").click(function(){ 
  $("input[name='id[]']").each(function(){
    if (this.checked) {
      this.checked = false;
    }
    else {
      this.checked = true;
    }
  });
})
//批量删除
function DelSelect(){
  var Checkbox=false;
   $("input[name='id[]']").each(function(){
    if (this.checked==true) {   
    Checkbox=true;  
    }
  });
  if (Checkbox){
    var t=confirm("您确认要删除选中的内容吗?");
    if (t==false) return false;   
    $("#listform").submit();    
  }
  else{
    alert("请选择您要删除的内容!");
    return false;
  }
}
</script>
</body>
</html>


<!DOCTYPE html> <html lang="zh-cn"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <meta name="renderer" content="webkit"> <title></title> <link rel="stylesheet" href="style/css/pintuer.css"> <link rel="stylesheet" href="style/css/admin.css"> <script src="style/js/jquery.js"></script> <script src="style/js/pintuer.js"></script> </head> <body> <form method="post" action="" id="listform"> <div class="panel admin-panel"> <div class="panel-head"><strong class="icon-reorder"> 新书列表</strong></div> <!-- <div class="padding border-bottom"> <ul class="search" style="padding-left:10px;"> <li> <a class="button border-main icon-plus-square-o" href="page.html"> 内容</a> </li> <input type="text" placeholder="请输入搜索关键字" name="keywords" class="input" style="width:250px; line-height:17px;display:inline-block" /> <a href="javascript:void(0)" class="button border-main icon-search" onclick="changesearch()" > 搜索</a></li> </ul> </div> --> <table class="table table-hover text-center"> <tr> <th width="100" style="text-align:left; padding-left:20px;">ID</th> <th width="10%">新书名</th> <th>图片</th> <th width="30%">作者</th> <th >简介</th> <th width="310">操作</th> </tr> <?php foreach ($data as $v){ ?> <tr> <td style="text-align:left; padding-left:20px;"><input type="checkbox" name="id" value="ar" /> <?php echo $v['id']?></td> <td><?php echo $v['bookname']?></td> <td width="10%"><img src="<?php echo $v['images']?>" alt="" width="70" height="50" /></td> <td><?php echo $v['author']?></td> <td><?php echo $v['introduction']?></td> <td> <div class="button-group"> <a class="button border-main" href="edit.php<?php echo '?id='.$v['id']?>"><span class="icon-edit"></span> 修改</a> <a class="button border-red" href="delete.php<?php echo '?id='.$v['id']?>" onclick="return del(1,1,1)"><span class="icon-trash-o"></span> 删除</a> </div> </td> </tr> <?php } ?> <td style="text-align:left; padding:19px 0;padding-left:20px;"><input type="checkbox" id="checkall"/> 全选 </td> <td colspan="7" style="text-align:left;padding-left:20px;"><a href="javascript:void(0)" class="button border-red icon-trash-o" style="padding:5px 15px;" onclick="DelSelect()"> 删除</a> </td> <tr> <td colspan="8"><div class="pagelist"> <a href="newbook.php?p=1">首页</a> <a href="newbook.php?p=<?php if(!$_GET){echo 1;}else{ if($_GET['p']==1){echo $_GET['p'];}else{echo $_GET['p']-1;}}?>">上一页</a><?php for($i=1;$i<$count+1;$i++){echo "<a href='newbook.php?p=$i'>$i</a>";}; ?> <a href="newbook.php?p=<?php if(!$_GET){echo ceil($count);}else{ if($_GET['p']==ceil($count)){echo $_GET['p'];} else{echo ceil($_GET['p'])+1;}}?>">下一页</a> <a href="newbook.php?p=<?php echo ceil($count);?>">尾页</a> </div> </td> </tr> </table> </div> </form> <script type="text/javascript"> //搜索 function changesearch(){ } //单个删除 function del(id,mid,iscid){ if(confirm("您确定要删除吗?")){ } } //全选 $("#checkall").click(function(){ $("input[name='id[]']").each(function(){ if (this.checked) { this.checked = false; } else { this.checked = true; } }); }) //批量删除 function DelSelect(){ var Checkbox=false; $("input[name='id[]']").each(function(){ if (this.checked==true) { Checkbox=true; } }); if (Checkbox){ var t=confirm("您确认要删除选中的内容吗?"); if (t==false) return false; $("#listform").submit(); } else{ alert("请选择您要删除的内容!"); return false; } } </script> </body> </html>
submitReset Code
ChapterCourseware