个人认为缺点:不能批量操作
一、请大家检阅
二、源码
全部在根目录下进行,phpmyadmin5.6,php5.3
1.index.php
<?php
$search = $_POST['search'];
$link = mysqli_connect("数据库url","用户名","秘密");
mysqli_select_db($link, "数据库");
mysqli_set_charset ($link,utf8);
$str ="select * from 表单 where name like '%".$search."%'";
$result = mysqli_query($link,$str);
$arr=array();
while($row = mysqli_fetch_array($result))
{
$arr[] = $row;
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>查询中心</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<style>
table,th,td{
border: 1px solid #000;
}
</style>
</head>
<body>
<div align="center">
<form action="" method="post">
<input type="text" name="search" value="">
<input type="submit" name="submit" value="搜索">
</form>
<table>
<th colspan="5">资源查询</th>
<tr>
<td>组号</td>
<td>姓名</td>
<td>完成情况</td>
<td>选择操作</td>
<td>常用钉钉号</td>
</tr>
<?php
foreach ($arr as $key=>$value)
{
?>
<tr>
<td><?php echo $value['id'];?></td>
<td><?php echo $value['name'];?></td>
<td><?php echo $value['xianshi'];?></td>
<td>
<form action="add.php" method="post"><input type="text" name="name" value="<?php echo $value['name'];?>" readonly="readonly" style="width: 1px">
<input type="radio" name="xianshi" value="已完成">已完成
<input type="radio" name="xianshi" value="未完成">未完成
<input type="radio" name="xianshi" value="特殊情况">特殊情况
<input type="submit" value="添加" />
</form>
</td>
<td><?php echo $value['dingding'];?></td>
</tr>
<?php
}
?>
</table>
</div>
</body>
</html>
2.add.php
<html>
<head>
<meta http-equiv="refresh" content="0;url=index.php">
</head>
</html>
<?php
$con = mysql_connect("数据库url","用户名","秘密");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_query("set names 'utf8'",$con);
mysql_select_db("数据库", $con);
$name=$_POST['name'];
$xianshi=$_POST['xianshi'];
$sql="UPDATE 表单 SET xianshi = '$xianshi' WHERE name = '$name'";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "添加成功";
mysql_close($con)
?>