php - 从数据库中选择 MySQL 在输入文本 html 中显示值 从另一个输入文本 html 中按值选择

标签 php html mysql

再次嗨堆栈溢出, 我想显示 MySQL 数据库中的值并以相同的形式显示它,这可能吗?

我有这样的 html 表单:

<td>Barcode/td> <<-- select from database by barcode input text and show result to input text dname, three, four, five
<td><input type='text' id="barkode" name='barkode'/></td>   
<td>Name</td>
<td><input type='text' id="dname" name='dname'/></td>   
<td>three</td>
<td><input type='text' id="three" name='three' /></td>    
<td>four</td>
<td><input type='text' id="four" name='four'/></td>  
<td>five</td>
<td><input type='text' id="five" name='five' /></td>  

任何引用任何评论都会有所帮助,谢谢

最佳答案

1.) 对您需要的数据进行选择查询。

2.)然后回显输入字段的 value 属性中的值

例如。

$res = $con->query('Select * from barcode where `id`=1'); 

$row = $res->fetch_assoc();

<input type='text' id="barkode" name='barkode' value='<?php echo $row['barcode']?>'>

关于php - 从数据库中选择 MySQL 在输入文本 html 中显示值 从另一个输入文本 html 中按值选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54827127/

相关文章:

MySQL JOIN 子查询为假。子查询会执行吗?

mySQL和一般数据库规范化问题

php - 在一行中显示文本、文本字段和按钮

jquery - 我的 HTML/CSS/javascript 中的什么会导致屏幕右侧出现奇怪的间隙?

html - Bootstrap 工具提示箭头样式

javascript - 在 Chrome 中页面加载时的 Popstate

php - 是否值得缓存简单的 MySQL 结果

php - 来自 PHP 的 MongoDB 集合 runCommand

php - SQLSTATE[42S01] : Base table or view already exists: 1050 Table 'weee_tax' already exists, 查询为

php - PDO 异常 "SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens"