473,405 Members | 2,272 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Through AJAX populate drop down

I need three drop down states,country,cities. States will populate from db then on the selection of state ..the list of coutries will populate and when select a country .its cities list will populate.
if some one can help out me please give me an example
Nov 8 '06 #1
3 11908
ronverdonk
4,258 Expert 4TB
You can accomplish this via pure PHP by submitting the form each time you have selected a drop-down value. That is not very nice and a bit of a hassle processing your form.

A much better solution is to use JavaScript and, better still, use Ajax. That way you can populate the boxes via an asynchronous call from the client to the server (php) program without refreshing your page or forcing the user to hit a 'submit' each time.

For Ajax, there is a demo (and the solution's code) at website dhtmlgoodies.com at page 'Ajax samples', which can be reached via link Chained select boxes

Good luck.

Ronald :cool:
Nov 8 '06 #2
yes i am doing it through ajax .. but now i have problem that onchange of sec drop down i didn't get third dropdown .it populate all the values. i want to populate the cities of the selected country .
Nov 8 '06 #3
ronverdonk
4,258 Expert 4TB
Not automatically with the sample I suggested.
You'll have to write a JavaScript function like the "getCityList(this)" for the extra catcher. And at the server side expand the code. So you'll have to have one catcher for for the count(r)y and one for the cities and a PHP (or other server) script that can handle both requests.

But 3 drop[-down lists are not in the sample, just 2 and that's why it is just a sample. You have to write that yourself. That can't be too difficult because you have a perfect example.

Ronald :cool:
Nov 8 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: julian | last post by:
hi I was wondering if anyone can help me out on this.... I have dynamcally populated a drop down menu with data from an access database using ASP. The values seem fine, however when i pass...
6
by: Greg Scharlemann | last post by:
I am attempting to populate a drop down menu based on the selection of a different drop down menu. However, it is not working correctly, I cannot figure out for the life of me what exactly happens...
1
by: Greg Scharlemann | last post by:
I would like to automatically populate a drop down menu when the page loads based on the selection of an item in a different drop down menu. I made a test page that when drop down #1 changes, drop...
7
by: Miguel Dias Moura | last post by:
Hello, i have an ASP.NET / VB page where i have a few 4 groups of Drop Down Lists. Each group of Drop Down Lists include 3 Drop Down Lists for date such as: DAY, MONTH, and YEAR. I don't want...
1
by: David Shorthouse | last post by:
Hello folks, I just started thinking about a db-driven, 3-tier nested option menu in AJAX instead of the typical onchange --> post. I seem to have something working, but the resultant formatting...
3
by: Yi Chen | last post by:
We have a drop down list on a PHP page, with several product names, and when people click one item, we will refresh the same page with the product name as parameter, and in turn we want to include...
0
by: john_mcmahon | last post by:
I'm having issues populating a second drop down menu that's dependent upon a selection in the first menu. When I select an option from the first menu, the second menu remains disabled, i.e. unable...
4
by: bips2005 | last post by:
i need to populate drop down box with database values. i have a field customername from table customer and i want a function that populates drop down in html with the values of this field. we have to...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.