advancedfuture Posted December 12, 2009 Share Posted December 12, 2009 I am stuck scratching my head over this problem. Here is my situation. I have 3 dropdown boxed. Box 1 = States Box 2 = Counties Box 3 = Cities What I am trying to accomplish is when the user selects their state, mysql will return the counties in that state in box 2, then when a county is selected box 3 will populate with all the cities in the county. Problem is PHP is all server side, so by the time the page loads it is done, how do I go about this problem? Just need idea's. Quote Link to comment https://forums.phpfreaks.com/topic/184898-how-do-i-go-about-this/ Share on other sites More sharing options...
RussellReal Posted December 12, 2009 Share Posted December 12, 2009 AJAX XMLHTTPRequest (Javascript) Quote Link to comment https://forums.phpfreaks.com/topic/184898-how-do-i-go-about-this/#findComment-976070 Share on other sites More sharing options...
ngreenwood6 Posted December 12, 2009 Share Posted December 12, 2009 There is no real good solution for this unless you use javascript or jquery(javascript library). If you are new to javascript and dont mind a little overhead by a library i would suggest looking into jquery if you want a quick solution. It simplifies ajax requests and is a little easier to get things done. However, I would not suggest strictly learning jquery. Jquery is simply a "wrapper" for javascript because it in reality uses javascript for all the code that is performed. So I would suggest that you learn javascript and then if you decide to use jquery it is always a great addition to your knowledge Quote Link to comment https://forums.phpfreaks.com/topic/184898-how-do-i-go-about-this/#findComment-976079 Share on other sites More sharing options...
advancedfuture Posted December 12, 2009 Author Share Posted December 12, 2009 Yeah I have a c++ / PHP background, the syntax is pretty similair. I am not strong on JavaScript, but with the project I have been working on I think I'm going to need to learn it. Thanks for the advice guys Quote Link to comment https://forums.phpfreaks.com/topic/184898-how-do-i-go-about-this/#findComment-976121 Share on other sites More sharing options...
ngreenwood6 Posted December 12, 2009 Share Posted December 12, 2009 no problem. if you arent using firefox i suggest using it and getting a plugin called firebug. you can run javascript right through the console window and it will show you a live view of what is going to happen to the page if you were to add that code to your site. Quote Link to comment https://forums.phpfreaks.com/topic/184898-how-do-i-go-about-this/#findComment-976126 Share on other sites More sharing options...
RussellReal Posted December 12, 2009 Share Posted December 12, 2009 no problem. if you arent using firefox i suggest using it and getting a plugin called firebug. you can run javascript right through the console window and it will show you a live view of what is going to happen to the page if you were to add that code to your site. +1 Kudos to you!!!! I love firebug Firebug also updates when the source updates.. so if you trigger a function in javascript or you do alot of javascript outputting.. you can easily see where the script outputs wrong should you output something wrong.. instead of having to find the problem the conventional way (Screening through hundreds of lines of code) Quote Link to comment https://forums.phpfreaks.com/topic/184898-how-do-i-go-about-this/#findComment-976182 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.