• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Creating conditional drop-down lists for a website.

xazraelx

New Member
Joined
Oct 23, 2007
Messages
179 (0.03/day)
Processor i7 920 @ 3.5ghz
Motherboard EVGA x58
Cooling HAF 932
Memory 3x2 Gskills
Video Card(s) Dying 4890 1gb
Storage Too many
Case HAF 932
Software Win7
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

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.65/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
PHP:
<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.
 
Joined
May 20, 2004
Messages
10,487 (1.45/day)
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

New Member
Joined
Oct 15, 2006
Messages
544 (0.09/day)
Processor Intel q9400 @ stock
Motherboard Lanparty P45-T2RS
Cooling Zalman CNPS-9500
Memory 8GB OCZ PC2-6400
Video Card(s) BFG Nvidia GTX285 OC
Storage 1TB, 500GB, 500GB
Display(s) 20" Samsung T200HD
Case Antec Mini P180
Audio Device(s) Sound Blaster X-Fi Elite Pro
Power Supply 700w Hiper
Software Ubuntu x64 virtualising Vista
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 ;)
 
Joined
May 20, 2004
Messages
10,487 (1.45/day)
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

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.65/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.65/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
I've never coded ASP.NET using C++ so I wouldn't know how sharp that learning curve is.
 

xazraelx

New Member
Joined
Oct 23, 2007
Messages
179 (0.03/day)
Processor i7 920 @ 3.5ghz
Motherboard EVGA x58
Cooling HAF 932
Memory 3x2 Gskills
Video Card(s) Dying 4890 1gb
Storage Too many
Case HAF 932
Software Win7
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.
 
Top