Connecting Tech Pros Worldwide Help | Site Map

How to populate combo box using php??

Newbie
 
Join Date: Aug 2009
Posts: 1
#1: Aug 26 '09
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's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,936
#2: Aug 26 '09

re: How to populate combo box using php??


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.
Reply