从我的列表中选择项目时如何从数据库中获取值? [英] How To Get The Values From Database When I Select An Item From My List?

查看:46
本文介绍了从我的列表中选择项目时如何从数据库中获取值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好..

我的表单中有一个列表..当我从列表中选择ID01时,我希望从我的数据库中的同一个表中输入名称,地址...出现在我的表单上的文本框中,以便我可以更新值..

帮帮我..

谢谢...

Hello..
I have a list in my form.. When i select ID "01" from the list i want the name, address ... from the same table in my database to appear in the text box on my form so that i can update the values..
Help me..
Thank you...

推荐答案

您会看到一个id,因为它位于显示HTML值的典型位置:标记之间。你需要这样的东西:



You see an the id because it is in the typical location to display an HTML value: between the tags. You need something like this:

ECHO "<option value='" .


row [' lecturer_id']。 '>
row['lecturer_id'] . "'>" .


row [' lecturer_lastname']。 < / option>;
row['lecturer_lastname']. "</option>";



这将显示名称作为选项,并将id作为选项的值返回。如果值是数据库表中的值,则可以轻松提取所请求的数据。



更新:修正错误的引号。


This will display the name as the option and return the id as the value of the option. If the value is that in your database table, you can easily pull the requested data.

Update: fixed incorrect quotes.


这篇关于从我的列表中选择项目时如何从数据库中获取值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆