SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Jan 2010
    Posts
    130
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    dropdown based on another

    Hi

    I have two table one for countries and one for cities (mysql database)

    i want to create drop down based on another drop down

    when select country from one the another one display cities of this country

    ??

  2. #2
    SitePoint Addict Banana Man's Avatar
    Join Date
    Dec 2005
    Posts
    389
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Are you looking for CSS advice or PHP / MySQL advice here?

    To get the cities returned for ever country just do a second MySQL query inside a while loop of all the returned countries, with the returned country in the WHERE clause of the second query.

  3. #3
    SitePoint Zealot
    Join Date
    Jan 2010
    Posts
    130
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i need php/mysql


    i do while loop for 2 dropdown to get data from database

    but i need to get cities according to countries

    now i get all countries and cities

  4. #4
    SitePoint Addict Banana Man's Avatar
    Join Date
    Dec 2005
    Posts
    389
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Do the cities while loop inside the countries while loop and put each country from the first while loop into the WHERE condition of the second cities while loop.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •