<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
$db= new Mysqli("localhost","root","root","asd_8080");
//empty(mysqli_connect_error())?"":die("连接错误"); $sql="select * from user where is_delete='0'";
$data= $db->query($sql)->fetch_all();
if (!empty($_POST)){
$name = $_POST['name'];
$sex = $_POST['sex'];
$birth_start=$_POST['birth_start'];
$birth_end = $_POST['birth_end']; $sql .= !empty($name)? "and name like '%{$name}%'":"";
$sql .= !empty($sex)? "and sex like '%{$sex}%'":"";
} ?>
<form action="mxdx2.php" method="post">
<table>
<tr>
<td>姓名:<input type="text" name="name"></td>
<td>性别:
<select name="sex">
<option value="1">男</option>
<option value="0">女</option>
</select>
</td>
<td>
年龄:<input type="text" name="birth_start">---<input type="text" name="birth_end">
</td>
<td>
<input type="submit" value="查询">
</td>
</tr>
</table>
</form>
<form action="plsc.php" method="post">
<table border="1">
<form border="2">
<tr>
<td>ID</td>
<td>姓名</td>!
<td>性别</td>
<td>年龄</td>
<td>出生年月</td>
</tr>
<?php
foreach ($data as $i){
if ($i[2]== 1 ){
$i[2]="男";
}else if ($i[2]== 0 ){
$i[2]="女";
}else{
$i[2]="保密";
}
echo "<tr><td>{$i[0]}<input type='checkbox' name='ids[]' value='{$i[0]}'></td><td>{$i[1]}</td><td>{$i[2]}</td><td>{$i[3]}</td><td>{$i[4]}</td><td><a href='mxdx3.php?id={$i[0]}'>删除</a></td>&nbsp;&nbsp;<td><a href='edit.php?id={$i[0]}'>修改</a></td></tr>";
}
?> </table>
<input type="submit" value="批量删除">
</form>
<a href="add.php">新增用户</a> </body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<form method="post" action="addpost.php">
<input type="text" name="name">
<input type="radio" name="sex" value="1" id="man" ><label for="man">男</label>
<input type="radio" name="sex" value="0" id="woman" ><label for="woman">女</label>
<input type="text" name="age" placeholder="年龄">
<input type="text" name="create_time" placeholder="出生年月">
<input type="submit" value="提交">
</form> </body>
</html>
<?php
$name = $_POST['name'];
$sex = $_POST['sex'];
$age=$_POST['age'];
$birthday = $_POST['create_time']; $db = new Mysqli("localhost","root","root","asd_8080");
$sql = "INSERT INTO user VALUES (NULL ,'{$name}',{$sex},'{$age}',{$birthday},'0')";
if($db->query($sql)){
header("location:mxdx2.php");
}else{
header("location:add.php");
}

<?php
$id = $_GET['id']; $db= new Mysqli("localhost","root","root","asd_8080");
mysqli_connect_error()?die("连接出错"):"";
$sql = "delete from USER WHERE id = {$id}";
$sql2 = "update user set is_delete ='1' WHERE id ={$id}";
if ($db->query($sql2)){
header("location:mxdx2.php"); }

<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<form action="editpost.php" method="post">
<input type="hidden" name="id" value="<?php echo $data['id']?>">
<input type="text" name="neme" value="<?php echo $data['neme']?>">
<input type="radio" name="sex" value="1" <?php if ($data['sex']==1){echo 'checked';}?> id="man" ><label for="man">男</label>
<input type="radio" name="sex" value="0" <?php if ($data['sex']==0){echo 'checked';}?> id="woman" ><label for="woman">女</label>
<input type="text" name="age" value="<?php echo $data['age']?>" placeholder="年龄">
<input type="text" name="create_time" placeholder="出生年月" value="<?php echo $data['create_time']?>">
<input type="submit" value="提交">
</form> </body>
</html>

<?php
$id=$_POST['id'];
$name = $_POST['neme'];
$sex = $_POST['sex'];
$age=$_POST['age'];
$birthday = $_POST['create_time'];
var_dump($name);
$db= new Mysqli("localhost","root","root","asd_8080");
$sql = "update `user` set neme='{$name}',sex='{$sex}',age ={$age},create_time='{$birthday}'WHERE id={$id}";
if ($db->query($sql)){
echo "执行成功";
}
												

最新文章

  1. 你真的了解UITabBarController吗?
  2. PHP入门【一】$_SERVER
  3. oracle的listener.ora sqlnet.ora tnsnames.ora三个文件的关联性
  4. SharePoint 项目的死法(一)
  5. Codeforces Round #260 (Div. 2) A~C
  6. iPad中控制器view初始的width和height
  7. XtraGrid使用心得(折叠式主细档、分组统计)
  8. const变量的存储区及修改权限
  9. SAP RFC函数远程调试跟踪管理软件
  10. appium+Python 启动app(二)
  11. python制作一个简单的中奖系统
  12. nasm预处理器(1)
  13. Win10上默认VS 2017以管理员身份运行
  14. Android Spinner 绑定键值对
  15. HNOI2019 爆零记
  16. MSSQL如何将查询结果拼接成字符串
  17. TWebSocketClient
  18. 微信小程序——template的使用方法
  19. python,如何获取字符串中的子字符串,部分字符串
  20. JavaScript Promise迷你书(中文版)

热门文章

  1. IIR型高斯滤波的原理及实现
  2. Python: How to iterate list in reverse order
  3. 134 Gas Station 加油站
  4. Pycharm中pygame报错
  5. VS2013编译libjpeg库
  6. ES6学习笔记(12)----Reflect
  7. Android学习笔记(十八) Socket
  8. Hibernate懒加载深入分析
  9. C# 移动控件
  10. 秒杀Sublime Text的微软开源代码编辑工具Visual Studio Code