How to load second DropDown list from Database after first DropDownList is changed(更改第一个 DropDownList 后如何从数据库加载第二个 DropDown 列表)
问题描述
我正在构建一个 Web 应用程序.在某些时候,用户需要向表单输入数据.此表单有几个文本字段和 DropDownLists
.
I am building a Web App.
At some point a user needs to input data to a form.
This form has several text fields and DropDownLists
.
其中一个 DDL 依赖于其先前的 DDL.发生的情况是,当用户从第一个 DDL 中选择一个值时,第二个 DDL 应该从数据库中加载与第一个 DDL 的所选值相关的数据.
One of the DDLs is dependent on its previous DDL. What happens is that when the user selects a value from the first DDL, the second DDL should load data from the database that are related to the selected value of the first DDL.
到目前为止,我只实现了 PHP
和 JS
,(没有 AJAX
、jQuery
或其他任何东西)来处理我的大部分问题.
Up to this point I've implemented only PHP
and JS
, ( no AJAX
, jQuery
or anything else ) for handling most of my problems.
我想知道如何在选择第一个 DDL 上的项目后从数据库填充第二个 DDL.
I'd like to know how to populate the 2nd DDL from the database after an item on the first DDL was selected.
任何帮助将不胜感激.谢谢!
Any help would be appreciated. Thank you!
推荐答案
Ajax 是您最好的选择.这个 会有所帮助
Ajax is your best bet. this will help
这篇关于更改第一个 DropDownList 后如何从数据库加载第二个 DropDown 列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:更改第一个 DropDownList 后如何从数据库加载第二个 DropDown 列表


- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- PHP foreach() 与数组中的数组? 2022-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- PHP - if 语句中的倒序 2021-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01