当前位置:网站首页>Modification du contenu de la recherche dans la boîte déroulante par PHP + MySQL
Modification du contenu de la recherche dans la boîte déroulante par PHP + MySQL
2022-04-23 02:37:00 【Éponge colorée】
Recherche basée sur la boîte déroulante précédente,Une fois le contenu ajouté à l'emplacement spécifique,Et le modifier.
<?php
error_reporting(0);//Pluserror_reporting(0);Il n'y aurait pas d'avertissement
header("Content-type:text/html;charset=utf-8");//Empêcher le Code chinois
$con = mysqli_connect("localhost","root","Mot de passe","Nom de la base de données liée");
mysqli_query($con,'set names utf8');
if (!$con){
echo'Impossible de lier la base de données!';
}
?>
<!DOCTYPE html>
<html>
<head></head>
<body>
<form action="" method="get" > //actionVide, c'estform Formulaire soumis à la page courante
<select name="id" >
<option >Veuillez sélectionner</option>
<?php
$sql="select * from userinfo ";
$res=mysqli_query($con,$sql);
while($row=$res->fetch_assoc()){
//var_dump($row);
?>
<option>
<?php echo $row["id"];?>
<?php echo $row["username"];?>
</option>
<?php
}
?>
</select>
<input type="submit" value="Soumettre">
</form>
<?php
$id = $_GET["id"];
//SelonidDonnées trouvées pour l'opération en cours
$sql= "select * from userinfo where id = '$id'";
//Requête
$result=$con->query($sql);
// var_dump($result);//dedao
//Obtenir des informations spécifiques
$res = $result->fetch_assoc();
?>
<form action="" method="get" >
<br /><br /><br /><br /><br /><br />
<input type="hidden" value="<?php echo $res['id'];?> " name="id" >
<label><b>Nom de l'utilisateur modifié</b></label>
<input type="text" value="<?php echo $res['username'];?> " name="username">
<label><b>Mot de passe de l'utilisateur</b></label>
<input type="text" value="<?php echo $res['password'];?> " name="password" >
<label><b>Niveau utilisateur:</b></label>
<input type="text" value="<?php echo $res['level'];?> " name="level">
<button type="submit" name="" >Modifier les informations</button>
</form>
<?php
//ModifierphpCode
$id = $_GET["id"];
$user = $_GET['username'];
$pwd = $_GET['password'];
$level = $_GET['level'];
//SelonidDonnées trouvées pour l'opération en cours
$sql= "update userinfo set username = '$user', password ='$pwd',level='$level' WHERE id = '$id'";
//Mise en œuvre
$result=$con->query($sql);
?>
</body>
</html>
版权声明
本文为[Éponge colorée]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230236378198.html
边栏推荐
- Use of go language web Middleware
- 双亲委派模型【理解】
- Lighting LED of IAR embedded development stm32f103c8t6
- Kubernetes cluster installation based on Kirin SP10 server version
- RT_Thread自问自答
- LeetCode 349. Intersection of two arrays (simple, array) Day12
- The usage and difference of * and & in C language and the meaning of keywords static and volatile
- Efficient music format conversion tool Music Converter Pro
- 谷雨
- Common formatting problems after word writing
猜你喜欢
Web learning record (medium)
Global, exclusive, local Routing Guard
Daily question (April 22, 2022) - rotation function
012_ Access denied for user ‘root‘@‘localhost‘ (using password: YES)
A domestic image segmentation project is heavy and open source!
Global, exclusive and local routing guard
Interpretation of the future development of smart agriculture
机器学习(周志华) 第十四章概率图模型
打靶narak
Jupyter for local and remote access to ECS
随机推荐
Water diversion into chengluo Valley p1514
[untitled]
Implementation of distributed scenario business operation log (based on redis lightweight)
Develop a chrome plug-in from 0 (2)
都是做全屋智能的,Aqara和HomeKit到底有什么不同?
【unity3D】直播间滚动式弹幕效果
Explain JS prototype and prototype chain in detail
MySQL JDBC编程
Class initialization and instance initialization interview questions
SQL server2019 cannot download the required files, which may indicate that the version of the installer is no longer supported. What should I do
002_ Redis_ Common operation commands of string type
Tp6 Alibaba cloud SMS window reports curl error 60: SSL certificate problem: unable to get local issuer certificate
Renesas electronic MCU RT thread development and Design Competition
C语言中*与&的用法与区别 以及关键字static和volatile 的含义
Interpretation of the future development of smart agriculture
小程序 读取文件
能做多大的单片机项目程序开发,就代表了你的敲代码的水平
PTA: 点赞狂魔
Jupyter for local and remote access to ECS
[xjtu Computer Network Security and Management] session 2 Cryptographic Technology