在php中选择选项时设置输入值 [英] Set input value upon select option in php

查看:190
本文介绍了在php中选择选项时设置输入值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张表格供我选择产品。在选定产品的基础上,我想更新表格中剩余的字段。



带有选择选项的表单显示



在选择产品名称时,我希望剩下的

以下是创建表的代码。

 < table id =productTableclass =table-c> 
< tr>
< th class =text-centerstyle =width:5%;> SR No.< / th>
< th class =text-centerstyle =width:45%> DESCRIPTION< / th>
< th class =text-centerstyle =width:10%> HSN / SAC< / th>
< th class =text-centerstyle =width:10%> QTY IN-HAND< / th>
< th class =text-centerstyle =width:10%> ENTER OUTWARD QTY< / th>
< th class =text-centerstyle =width:5%>删除< / th>
< / tr>
< tr style =text-align:center; ID = 产品 >
<?php $ j = 0; $ J ++; ?>
< td><?php echo $ j; ?>< / TD>
< td>< select class =form-controlname =codeid =productIDstyle =width:429px;>
<?php

$ sql =SELECT * FROM`product`;
$ result = $ conn-> query($ sql);

if($ result-> num_rows> 0){
//每行输出数据
while($ row = $ result-> fetch_assoc()) {
echo'< option id ='。$ row ['code']。'value ='。$ row ['pname']。'>。$ row ['pname' ]。 < /选项> 中;
}
} else {
echo0 results;
}
?>
< / select>
< / td>
< td>< input type =numbername =hsnNoid =hsnNoreadonly>< / td>
< td>< input type =numbername =qtyid =qtyreadonly>< / td>
< td class =coljoin>< input type =numberformat =2name =amount>< / td>
< td>
< span class =fa fa-trash>< / span>
< / td>
< / tr>
< / table>

我应该怎么做?

解决方案

这是PHP代码: -

code><形式>
发送“验证码”获取 | 15天全站免登陆