問題描述
我正在構建一個 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 列表的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!