第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

doAction.php頁(yè)面,提交按鈕,彈出添加成功之后

在跳轉(zhuǎn)回userList.php頁(yè)面前的一瞬間,閃過(guò)一個(gè)錯(cuò)誤提示頁(yè)面,只有一瞬間,但不知道為什么,我把代碼貼出來(lái),大家?guī)臀铱纯? =

正在回答

3 回答

//這是addUser.php頁(yè)面代碼

<!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="請(qǐng)輸入用戶名" required="required"></td>

? ? </tr>

? ? <tr>

? ? ? ? <td>密碼</td>

? ? ? ? <td><input type="password" name="password" placeholder="請(qǐng)輸入密碼" required="required"></td>

? ? </tr>

? ? <tr>

? ? ? ? <td>年齡</td>

? ? ? ? <td><input type="text" name="age" min="1" max="125" placeholder="請(qǐng)輸入年齡"></td>

? ? </tr>

? ? <tr>

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

? ? </tr>

</table>

</form>

</body>

</html>


0 回復(fù) 有任何疑惑可以回復(fù)我~

//這是doAction.php頁(yè)面

<?php

header('content-type;text/html;charset=utf-8');

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

if($con->connect_errno){

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

}

$username=$_POST['username'];

$username=$con->escape_string($username);

$password=md5($_POST['password']);

$age=$_POST['age'];

$act=$_GET['act'];

? ??

? ? switch($act){

? ? case addUser:

? ? $sql="INSERT user(username,password,age) VALUES('$username','$password','$age')";

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

? ? if($res){

? ? $insert_id=$con->insert_id;

? ? echo "<script type='text/javascript'>?

? ? alert('添加成功,你是網(wǎng)站的第{$insert_id}位用戶');

? ? location.href='userList.php';

? ? ?</script>";

? ? }else{

? ? echo "<script>?

? ? alert('添加失敗,重新添加');

? ? location.href='addUser.php';

? ? ?</script>";

? ? }

? ? break;

? ? }

?>

0 回復(fù) 有任何疑惑可以回復(fù)我~

//這是userList頁(yè)面代碼

<?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>用戶編號(hào)</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 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

doAction.php頁(yè)面,提交按鈕,彈出添加成功之后

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)