为了账号安全,请及时绑定邮箱和手机立即绑定

doAction.php页面,提交按钮,弹出添加成功之后

在跳转回userList.php页面前的一瞬间,闪过一个错误提示页面,只有一瞬间,但不知道为什么,我把代码贴出来,大家帮我看看= =

正在回答

4 回答

//这是addUser.php页面代码

<!DOCTYPE html>

<html>

<head>

    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">

    <title>添加用户</title>

</head>

<body>

<h2>添加用户</h2>

<form action="doAction.php?act=addUser" method="post">

<table cellpadding="0" cellspacing="0" bgcolor="#ABCDEF" width="45%" border="1">

    <tr>

        <td>用户名</td>

        <td><input type="text" name="username" placeholder="请输入用户名" required="required"></td>

    </tr>

    <tr>

        <td>密码</td>

        <td><input type="password" name="password" placeholder="请输入密码" required="required"></td>

    </tr>

    <tr>

        <td>年龄</td>

        <td><input type="text" name="age" min="1" max="125" placeholder="请输入年龄"></td>

    </tr>

    <tr>

        <td colspan="2"><input type="submit" name="" value="提交"></td>

    </tr>

</table>

</form>

</body>

</html>


0 回复 有任何疑惑可以回复我~

//这是userList页面代码

<?php

$con=new mysqli('localhost','root','','test');

if($con->connect_errno){

die('ERROR: '.$con->connect_error);

}

$sql="SELECT id,username,age FROM user";

$res=$con->query($sql);

if($res&&$res->num_rows>0){

$row=$res->fetch_all(MYSQLI_ASSOC);

}

?>


<!DOCTYPE html>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html;charset=utf-8">

<title>用户列表</title>

</head>

<body>

<h2>用户列表-<a href="addUser.php">添加用户</a></h2> 

<table border='1' cellspacing="0" cellpadding="0" width="80%" bgcolor="#ABCDEF">

<tr>

<td>用户编号</td>

<td>用户名</td>

<td>年龄</td>

<td>操作</td>

</tr>

<?php foreach ($row as $value): ?>

<tr>

<td><?php echo $value['id'] ?></td>

<td><?php echo $value['username']?></td>

<td><?php echo $value['age']?></td>

<td><a href="doAction.php">更新</a>|<a href="delete.php">删除</a></td>

</tr>

<?php endforeach; ?>

</table>

</body>

</html>


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

doAction.php页面,提交按钮,弹出添加成功之后

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信