1.查找会议记录模块概述
当添加的会议记录太多时,逐条查找对于使用者是一件十分困难的事情,这时用户可以通过单击“查找会议记录”超级链接切换到会议记录查找页面,在输入查询内容并选择查找方式之后,单击“查询”按钮即可对特定的会议记录进行搜索查询。
2.分类查找技术
在查找会议记录模块中,需要选择查找类型对数据进行分类查找,在后台获取类型传递值,并通过if判断语句执行不同的查询操作。并将查询的结果集输出到查询结果显示页show.php中。
3.查找会议记录实现过程
查找会议记录是通过表单提交的关键字来查询的,将符合条件的查询结果作为返回结果输出。分类查找功能由查找页found.php和显示页show.php两个文件组成。
在found.php文件中,创建表单,提交会议记录的查找关键字。其关键代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<form id="found" name="found" action="show.php" method="post">
<td>
<td height="26">
查询内容:
</td>
<td>
<input class="input_found" name="characters" type="text" />
</td>
</tr>
<tr>
<td height="26">查找类型:</td>
<td align="left">
<select name="findtype">
<option value="0"><-查找类型-></option>
<option value="1">会议编号</option>
<option value="2">会议名称</option>
</select>
</td>
</tr>
<tr>
<td height="26" colspan="3" align="center">
<input class="found_btn" type="submit" value="查找" />
</td>
</tr>
</form>
</body>
</html>
上述代码同样需要使用javascript脚本来判断输入的查询内容是否为空。
创建show.php文件,根据表单提交的关键字,执行查询操作,并且输出查询结果。其关键代码如下:
<?php
header("Content-Type:text/html;charset=utf-8");
date_default_timezone_set('PRC'); // 设置为北京时间
session_start();
include_once("conn/conn.php");
$char = $_POST["characters"]; // 将POST传递参数赋值给变量
$type = $_POST["findtype"];
echo "搜素关键词为:".$char."<br />";
echo "查找类型为:".$type;
if($type === '0'){ // 判断是否选择查找类型
echo "<script>alert('请选择查找类型!');history.go(-1);</script>";
}else if($type === '1'){ // 按会议编号查找
$sqlstrv = "select * from tb_meeting_info where meeting_id=$char";
}else if($type === '2'){ // 按会议名称查找
$sqlstrv = "select * from tb_meeting_info where meeting_name like '%".$char."%'";
}
$testrst = mysql_query($sqlstrv);
if(!mysql_num_rows($testrst)){ // 查找返回数量,判断是否存在相应记录
echo "没有匹配的查询结果!";
}else{
?>
<h3>会议信息浏览</h3>
<table width="730" border="0" cellspacing="0" cellpadding="0">
<tr class="tableheader">
<td width="50">会议编号</td>
<!-- 省略部分代码 -->
</tr>
<?php
while($row=mysql_fetch_array($testrst)){
?>
<tr>
<td height="22"><?php echo $row['meeting_id']?></td>
<!-- 省略部分代码 -->
</tr>
<?php }
?>
</table>
<?php
}
?>
在会议记录管理系统中,还包括用户账户管理模块、会议信息管理模块、部门管理模块等,这里不再赘述。