How to populate combo box using php??

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ajmal5
    New Member
    • Aug 2009
    • 1

    How to populate combo box using php??

    I use two combo in forms. One for Country and other for City. What i do when i selected Country the City combo is populated through country. Thanks in Advance.
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    AJAX is the preferred method of doing this.

    When one drop down is changed, you make a request to your PHP script, telling it which country was selected. It then queries a database (if you're using one) and returns the cities in that country. You then use javascript to populate the city drop down with the cities returned by the request.

    Mark.

    Comment

    Working...