1 Star 0 Fork 0

李晓敏 / php

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
edituser.php 2.48 KB
一键复制 编辑 原始数据 按行查看 历史
李晓敏 提交于 2024-05-08 08:25 . 0508
<!DOCTYPE html>
<?php
$frist=!count($_POST);
?>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
if($frist){
if($_GET["id"]){
$uid=(int)$_GET["id"];
//要求用户id必须是数字
if($uid){
$hostname="127.0.0.1";
$username="root";
$password="123456";
$database="myshop";
$connect=mysqli_connect($hostname, $username,
$password, $database);
//设置连接的字符集
mysqli_set_charset($connect, "utf-8");
if($connect){
$sqlstring="select * from userinfos where uid=${uid}";
$result=mysqli_query($connect, $sqlstring);
//mysqli_num_rows 获得查询结果集中有多少条数据
if( mysqli_num_rows($result)==0){
echo "参数错误";
}else{
$row= mysqli_fetch_array($result);
?>
<h1>添加用户</h1>
<form action="edituser.php" method="post" enctype="multipart/form-data">
账户:<input type="text" name="username" value="<?php echo $row["username"];?>"/><br/>
密码:<input type="password" name="upwd" value="<?php echo $row["upasswd"];?>"/><br/>
性别:<select name="sex">
<option <?php echo $row["sex"]=='男'?"selected=\"selected\"":"";?> ></option>
<option <?php echo $row["sex"]=='女'?"selected=\"selected\"":"";?> ></option>
</select>
<br/>
年龄:
<select name="age">
<?php
for($index=18;$index<=100;$index++){
if($index==$row["age"]){
echo "<option selected=\"selected\">$index</option>";
}else{
echo "<option>$index</option>";
}
}
?>
</select>
<br/>
原来头像:<img src="<?php echo $row["pic"];?>" style="height: 100px;width: 100px;" />
<br/>
更改头像:<input type="file" name="myimg"/><br/>
<input type="submit" value="确定"/>
<input type="reset" value="取消"/>
</form>
<?php
}
}
}else{
echo "参数错误";
}
}
?>
<?php
}
?>
</body>
</html>
1
https://gitee.com/li-iaoin/php.git
git@gitee.com:li-iaoin/php.git
li-iaoin
php
php
master

搜索帮助