亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

PHP development corporate website tutorial modification administrator

We have seen the display page, modified, and linked to the modifu.php page

Let’s look at the code of the following page:

<?php
    require_once('conn.php');
    $id = $_GET['id'];
    $sql = "SELECT * FROM user where id='$id'";
    $info = mysql_query($sql);
    $row = mysql_fetch_array($info);
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>修改管理員</title>
    <style type="text/css">
        .ipt{width:180px;height:30px;border-radius:5px;outline:none;border:1px solid #eee;box-sizing:border-box;padding-left:15px;}
        .sub{width:50px;height:20px;border:1px solid #eee;background:#eee;color:#ff7575;}
    </style>
</head>
<body>
    <form method="post" action="modifyuser.php?id=<?php echo $id;?>">
    用戶名:<input type="username" name="username" class="ipt" value="<?php echo $row['username'];?>">
        </br></br>
    密&nbsp;碼:<input type="password" name="password" class="ipt" value="<?php echo $row['password'];?>">
        </br></br>
        <input type="submit" value="修改" class="sub">
    </form>
</body>
</html>

Connect to the database

Then Get the id mentioned over there and query based on the id, save the database information to the page, so that we can delete the information and make modifications

Processing the modified php file modifyuser.php We also have a Parameter id

Let’s look at the code of the following modifyuser.php page:

<?php
    //修改頁面php代碼
    require_once('conn.php');
    $name = $_POST['username'];
    $password = md5($_POST['password']);
    $id = $_GET['id'];
    $sql = "UPDATE user SET username='$name',password='$password' where id='$id'";
    $res = mysql_query($sql);
    if($res){
        echo "<script>alert('修改管理員成功');location.href='user.php'</script>";
    }else{
        echo "<script>alert('修改管理員失敗');history.go(-1);</script>";
    }

?>

With the above code, we have completed the function of modifying the administrator

Continuing Learning
||
<?php require_once('conn.php'); $id = $_GET['id']; $sql = "SELECT * FROM user where id='$id'"; $info = mysql_query($sql); $row = mysql_fetch_array($info); ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>修改管理員</title> <style type="text/css"> .ipt{width:180px;height:30px;border-radius:5px;outline:none;border:1px solid #eee;box-sizing:border-box;padding-left:15px;} .sub{width:50px;height:20px;border:1px solid #eee;background:#eee;color:#ff7575;} </style> </head> <body> <form method="post" action="modifyuser.php?id=<?php echo $id;?>"> 用戶名:<input type="username" name="username" class="ipt" value="<?php echo $row['username'];?>"> </br></br> 密 碼:<input type="password" name="password" class="ipt" value="<?php echo $row['password'];?>"> </br></br> <input type="submit" value="修改" class="sub"> </form> </body> </html>
submitReset Code