donglinxia1541 2015-07-06 12:49 采纳率: 0%
浏览 77

在php中填充select标签

I have a many masters in my project of the basic one is country,state and city. i have added/inserted the records in mysql database but when i want to edit record how can i populate the state select tag when the country is selected from mysql database?

For example i have a record in city table as

╔════╦══════════════╦════
║ COUNTRY║  STATE║ CITY ║
╠========╬══════════════╬
║  INDIA ║ PUNJAB║ ABC  ║
║  INDIA ║ J&K   ║ PQR  ║
║  USA   ║ NJ    ║ MNO  ║
=========================

NOW when i go for edit operation for say suppose record 1 i.e INDIA-PUNJAB-ABC

I am able to select INDIA in Country select tag but i am not able to get only INDIA states and select ABC in select tag of state

  • 写回答

2条回答 默认 最新

  • doupeng6890 2015-07-06 12:55
    关注

    However you achieve this, you will need to interrogate the db using the selected COUNTRY. So..

    1. Option 1 :perform an AJAX request 'onChange' of the COUNTRY to populate the CITY box using Javascript

    2. Option 2 : refresh/submit the page 'onChange'of the COUNTRY and use the posted COUNTRY field to generate a filtered list of CITY options to use in the

    评论

报告相同问题?

悬赏问题

  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题
  • ¥20 RL+GNN解决人员排班问题时梯度消失
  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗