PHP- Fetch from database and store in drop down menu html(PHP- 从数据库中获取并存储在下拉菜单 html 中)
问题描述
我似乎无法获得以下代码来制作包含来自 mysql 数据库的数据的下拉菜单.包含('connect.php');"连接到 mysql 数据库,我知道它在不同的页面上工作.有什么建议?
I can't seem to get the following code to make a dropdown menu that contains data from a mysql database. The "include('connect.php');" connects to the mysql database and I know it works on separate pages. Any suggestions?
以下是完整代码.列出客户
Below is the entire code. listCustomer
推荐答案
从表面上看,您缺少一个开始选项标签,所以它只是输出Dropdown"作为一行文本.
From the looks of things, you're missing an opening option tag, so it's just outputting "Dropdown" as a line of text.
为了完全透明,因为我没有connect.php
,我不得不添加我自己的数据库连接.我的整个页面看起来如此:
Just to be completely transparent, because I did not have connect.php
, I had to add my own DB connections. My whole page looked thusly:
这篇关于PHP- 从数据库中获取并存储在下拉菜单 html 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!