静态页面
<form action="houtai.php" method="get">
ID:<input type="text" name="id" />
学院:<select name="school" >
<option></option>
<option>音乐学院 - 东校区</option>
<option>体育学院 - 东校区</option>
<option>信息学院 - 北校区</option>
<option>历史学院 - 南校区</option>
<option>哲学学院 - 东校区</option>
<option>商务学院 - 东校区</option>
<option>物理学院 - 东校区</option>
<option>生物学院 - 东校区</option>
<select>
年级:<select name="date">
<option></option>
<option>2019</option>
<option>2018</option>
<option>2017</option>
<option>2016</option>
<option>2015</option>
<option>2014</option>
<option>2013</option>
<option>2012</option>
<select>
名称(*):<input type="text" name="name" >
排序:<select name="qai">
<option></option>
<option>编号</option>
<option>名称</option>
<option>系主任</option>
<option>入学年份</option>
<option>学院</option>
<select>
排序方式:<select>
<option></option>
<option>顺序</option>
<option>倒序</option>
<select>
<input type="submit" value="查询" class="btn btn-primary">
</form>
PHP页面
//查找、选择数据库
mysqli_query($conn , "set names utf8");
mysqli_select_db( $conn, 'glks' );
//每页显示的留言数
$pagesize=3; ;
//确定页数 page 参数
$p = isset($_GET['p']) ? $_GET['p'] : 1;
//数据指针(指定每页从第几条开始)
$offset = ($p-1)*$pagesize;
$wherelist=array();
$urllist=array();//判断
error_reporting(E_ALL ^ E_NOTICE);
//@$search=$_GET['search'];
@$id=$_GET['id'];
@$yes=$_GET['school'];
@$no=$_GET['grade'];
@$my=$_GET['px'];
@$mc=$_GET['designation'];
@$ps=$_GET['pxfs'];
if(!empty($id)){
$wherelist[]="number like '%{$_GET['id']}%'";
$urllist[]="id={$_GET['id']}";
}
if(!empty($yes)){
$wherelist[]="academy like '%{$_GET['school']}%'";
$urllist[]="school={$_GET['school']}";
}
if(!empty($no)){
$wherelist[]="enrollment like '%{$_GET['grade']}%'";
$urllist[]="grade={$_GET['grade']}";
}
if(!empty($mc)){
$wherelist[]="name like '%{$_GET['designation']}%'";
$urllist[]="designation={$_GET['designation']}";
}
if(!empty($ps)){
$wherelist[]="number like '%{$_GET['id']}%'order by number desc";
$urllist[]="id={$_GET['id']}";
}
if(count($wherelist)>0){
$where=" where ".implode(" and ",$wherelist);
$url=@"&".implode("&",$urllist);
}
$query_sql ="select * from student $where LIMIT $offset , $pagesize";
$result = mysqli_query($conn , $query_sql);
echo'<table border="1" class="table">',
'<tr>',
'<th>操作</th><th>编号</th><th>名称</th><th>系主任</th><th>入学年份</th><th>学院</th>',
'</tr>';
while($gblist = mysqli_fetch_array($result)){
echo"<tr>",
"<td><a href='redact.php?id={$gblist['id']}'>编辑</a>  ".
"<a href='delete.php?id={$gblist['id']}'>删除</a> </td> ".
'<td>' , $gblist['number'] , '</td>',
'<td>' , $gblist['name'] , '</td>',
'<td>' , $gblist['department'] , '</td>',
'<td>' , $gblist['enrollment'] , '</td>',
'<td>' , $gblist['academy'] , '</td>',
'</tr>';
}
echo'</table>';