PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 6th, 2000, 02:51 AM
tim miller tim miller is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2000
Location: Hillsboro, OR, USA
Posts: 12 tim miller User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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

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

Reply With Quote
  #2  
Old June 6th, 2000, 11:14 PM
Dave Bryant
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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).]

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > One drop down box effecting another.

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap