Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/184898-how-do-i-go-about-this/
Share on other sites

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

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.

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 :D

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)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.