drop down and forms

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
apalm
Forum Newbie
Posts: 8
Joined: Tue Aug 01, 2006 8:32 am

drop down and forms

Post by apalm »

Hi

I would like to know how to build a drop down menu in one PHP page based on the answer of previous drop down menu.

example.

first drop down contained :

Manhattan/Queens/Staten Island/Bronx

Depending on what location, different cities will show.

if Manhattan -> UES (upper east side), UWS, Downtown, etc


Anna
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Re: drop down and forms

Post by Luke »

apalm wrote:I would like to know how to build a drop down menu in one PHP page based on the answer of previous drop down menu.
when you say drop-down menu, are you talking about a select tag?

Code: Select all

<select name="selectbox"><option value="bla"></option></select>
Also, do you plan on this information refreshing without a page reload?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

CoderGoblin has a tutorial posted that talks of doing this (using stored arrays in Javascript) which may be of interest.

viewtopic.php?t=29084
apalm
Forum Newbie
Posts: 8
Joined: Tue Aug 01, 2006 8:32 am

drop down and forms

Post by apalm »

Yes, I am talking about the select tag. If I understood correctly the is no way of doing it in PHP without javascript help correct???

The example seem to be a little bit more that what I need.

Maybe this will clear a little bit more.

I need a php page that will show two drop down menus. The first with cities and the second with specialty. Once the specialty is selected a third drop down menu will show with a variaty for the specialty.

example: 2 drop down will have medical/dentist/labs/etc

If the user wants medical, the third menu will contain Cardio/Anesthesiology/Ophthalmology/etc

and so on.

How can I do that??


Thank you for your help.

Anna
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

Yes, I am talking about the select tag. If I understood correctly the is no way of doing it in PHP without javascript help correct???
Correct but you can do it with only very little JS.
Maybe this will clear a little bit more.
I think we understand what you want to achieve. I also understand that you probably want to use the method with least JS. In which case see method one in my post on this thread.
apalm
Forum Newbie
Posts: 8
Joined: Tue Aug 01, 2006 8:32 am

Post by apalm »

Thank you.

:)

Anna
Post Reply