#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Location
    Hillsboro, OR, USA
    Posts
    12
    Rep Power
    0
    I am trying to have one drop down box effected by another drop down box on one page only. I would like a user to select their state from a drop down box, then depending on what state they choose, I would like the list of cities from another drop down box to be displayed that are linked to that state in a mysql database. The purpose is to keep the list of cities to choose from small, they should not have to waid through a list which contains cities in other states.

    Is it posable?

    Thank you
    Tim

    ------------------
  2. #2
  3. No Profile Picture
    Dave Bryant
    Guest
    Devshed Newbie (0 - 499 posts)
    Defintely possible. I'd store each group of cities in a seperate array, $state1,$state2, etc. Then have a function call with switch statements for each array, if $state1 then echo all elements of the array to the second form list box (or set a second array which gets echoed later in between the html code). When the first drop down box is selected, the page will have to refresh (in other words, the form action will need to call itself) and the second drop down will then show correct cities. This avoids using javascript which since I'm not familiar with, this is how I would do it. (without a database)

    You may want to hook this to a database if you have access and have two tables. When you access the appropriate state, you can fetch array (I believe) and get all the cities with that state code. Then it's easy, but you need database access.

    ------------------


    [This message has been edited by Dave Bryant (edited June 06, 2000).]

Similar Threads

  1. MySQL output to table using phpBB
    By CCCMTech in forum PHP Development
    Replies: 0
    Last Post: February 2nd, 2004, 02:43 PM
  2. retrieving data from a drop down box for modifying
    By swordfishy in forum PHP Development
    Replies: 0
    Last Post: January 18th, 2004, 08:07 PM
  3. changing the buttons in the message box
    By crackerweb in forum Visual Basic Programming
    Replies: 6
    Last Post: October 23rd, 2003, 06:36 PM
  4. Simple MySQL search with a drop down box
    By marlowe1999 in forum PHP Development
    Replies: 2
    Last Post: September 27th, 2003, 04:32 PM
  5. Problem drop down box HTML
    By ruffle in forum HTML Programming
    Replies: 0
    Last Post: September 24th, 2003, 01:41 PM

IMN logo majestic logo threadwatch logo seochat tools logo