# Creating conditional drop-down lists for a website.



## xazraelx (Oct 8, 2008)

Is there a way to create a conditional drop-down list.  For example, let's say we're building a computer.

First they choose a type of processor...if it's a socket LGA 775, then the motherboard will automatically narrow to only LGA 775 boards, but if they want a socket 939, it will only display socket 939 boards.  I'm kind of on the beginner-intermediate level when it comes to programming, but I'm more familiar with java and C++ than anything.  I'm trying to learn some html/css/etc, just to prepare some basic websites.

Thanks TPU =)


----------



## FordGT90Concept (Oct 13, 2008)

```
<select name="something">
  <option value="return1">Option 1</option>
  <option value="return2" checked="checked">Option 2</option>
  <option value="return3">Option 3</option>
</select>
```
The code (server or client) basically has to produce the option rows and spit out the checked statement on the one you want automatically selected.


----------



## Deleted member 3 (Oct 13, 2008)

Fill dropdowns from queries. You could read the selected item from another dropdown/checkbox/whatever and use that in your query.

ie select * from motherboards where socket = whateverthedropdownsays. Of course your code would be generating the right query there.


----------



## Oliver_FF (Oct 13, 2008)

You'll probably need to use javascript to show and hide items in the list on the fly by altering the styling.

Or, if the pages are generated by the server and the page reloads when people pick things then you can use PHP or JSP's to spew out just the relevant rows.

Start googling javascript events


----------



## Deleted member 3 (Oct 13, 2008)

Oliver_FF said:


> You'll probably need to use javascript to show and hide items in the list on the fly by altering the styling.
> 
> Or, if the pages are generated by the server and the page reloads when people pick things then you can use PHP or JSP's to spew out just the relevant rows.
> 
> Start googling javascript events



Java, PHP, ASP or even Flash or Silverlight, all can do the trick. There simply needs to be some database backend. Could also be anything, probably some SQL variant.
I'd say pick a platform first.


----------



## FordGT90Concept (Oct 13, 2008)

DanTheBanjoman said:


> I'd say pick a platform first.


I agree.  Seeing that you already have C++ experience, PHP would probably be the best way to go.


----------



## Deleted member 3 (Oct 13, 2008)

FordGT90Concept said:


> I agree.  Seeing that you already have C++ experience, PHP would probably be the best way to go.



Actually according to that logic ASP.NET would be easier. A lot less flexibility when it comes to server choice though.


----------



## FordGT90Concept (Oct 13, 2008)

I've never coded ASP.NET using C++ so I wouldn't know how sharp that learning curve is.


----------



## Deleted member 3 (Oct 13, 2008)

FordGT90Concept said:


> I've never coded ASP.NET using C++ so I wouldn't know how sharp that learning curve is.



It's .NET, VBA and C#.


----------



## xazraelx (Oct 23, 2008)

Thanks for all the replies - I hadn't taken a peek at this thread in a while.  I'm going to hold off on this little learning experience for a bit, but I've used SQL before in a couple classes, and will probably be trying something using that and just accessing it.  I certainly don't mind learning new things, nothing is ever useless, and may be back.

Again, all the feedback is appreciated.


----------

