二 展示用户后台信息

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>用户信息后台管理系统</title>
</head>

<!--表格的格式 用css 写的-->
<style type="text/css">

    .wrapper {width: 1000px;margin: 20px auto;}
    h2 {text-align: center;}
    .add {margin-bottom: 20px;}
    .add a {text-decoration: none;color: #fff;background-color: green;padding: 6px;border-radius: 5px;}
    .exit {margin-bottom: 20px;}
    .exit a {text-decoration: none;color: #fff;background-color: #800907;padding: 6px;border-radius: 5px;}
    td {text-align: center;}

</style>

<body>
<div class="wrapper">
    <h2>用户信息后台管理系统</h2>
    <div class="add">
        <a href="enroll.php" target="_blank">添加信息</a>   <!--跳转到注册页面-->
    </div>
    <div class="exit">
        <a href="http://baidu.com">退出</a>
    </div>
<!-- 在这添加的是查询的搜索框 根据姓名和手机号进行查询   -->
    <form action="chaxun.php" method="post" name="form2" >
        <input name="info" type="text" placeholder="姓名或手机号" />
        <input name="Submit" type="submit" value="查询" />   <!--提交后转到chaxun.php 进行查询操作-->
    </form>
    <br>
<!--表格的信息  -->
    <table width="960" border="1" align =''>
        <tr>
            <th>姓名</th>
            <th>性别</th>
            <th>爱好</th>
            <th>手机号</th>
            <th>邮箱</th>
            <th>头像</th>
            <th>备注</th>
            <th>id</th>
            <th>删除</th>
            <th>修改</th>
        </tr>
        <?php

            //连接数据库
            $mysqli = mysqli_connect('localhost','root','3589216','php10');
            if (!$mysqli) {
                printf("Can't connect to MySQL Server. Errorcode: %s ", mysqli_connect_error());
                exit;}
            mysqli_query($mysqli , "set names utf8");

            //查询数据库中用户信息,并显示在网页上
            $sql = 'select * from msg';
            $retval = mysqli_query( $mysqli, $sql );
            if(! $retval )
            {
                die('无法读取数据: ' . mysqli_error($mysqli));
            }

            //把记录循环输出,否则只会输出一条
            while($row = mysqli_fetch_array($retval, MYSQLI_ASSOC))
            {
                echo "<tr>
                         <td> {$row['name1']}</td> ".
                        "<td>{$row['sex']} </td> ".
                        "<td>{$row['interest']} </td> ".
                        "<td>{$row['mobile']} </td> ".
                        "<td>{$row['email']} </td> ".
                        "<td>{$row['files']} </td> ".
                        "<td>{$row['remark']} </td> ".
                        "<td>{$row['id']} </td> ".
                        "<td><a href='javascript:del({$row['id']})'>删除</a> </td>".
//弹窗确定<script>标签 注意连接的.
                        "<td><a href='change.php?id={$row['id']}'>修改</a> </td>   
//连接到change.php
                     </tr>";
            }

        ?>
    </table>
</div>
</body>
<!--要删除时的弹窗-->
<script type="text/javascript">
    function del (id) {
        if (confirm("确定删除这条信息吗?")){
            window.location = "delete.php?id="+id;  
/*连接到delete.php --> 连接数据库 --> 删除*/
        }
    }
</script>
</html>

简单描述下:

一张表格里面有用户信息 ,当你点击确认删除后,会跳转到delete.php 进行删除,然后在返回到后台的页面

表格上面会有添加的按钮,点击后会跳转到enroll.php,进行用户信息的添加

每行上会有一个修改的按钮  点击后会跳转到change.php 中,会展示出像注册的页面,但是用户的信息,会显示在页面上,比如选择的图像,进行修改在提交

还会有一个查询的按钮,根据用户名和手机号进行查询,点击后跳转chaxun.php

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值