Jump to content

Working with form select (drop down) and database


xyzleft

Recommended Posts

Hey all, I'm fairly new to php and I'm having trouble getting this to work.

 

What I'm trying to do is have 3 select fields.. one each for a vehicle make, model, and year. I have the options for make loaded from the database when the user enters the page.

 

My question is how to populate the model select field from the database based on what the user selects for the make, and then do the same thing for the year, based on the make & model.

 

I'm not looking for code to work with mysql database, but basically how to stay on the same page and update the select fields from the database until all three are selected. At this point, the form can be submitted with the make/model/year to display the corresponding parts.

 

Can someone point me in the right direction here? I have a feeling I'm just missing a simple concept. I'm able to make this work, but that involves using three separate php pages, which doesn't seem efficient to me.

 

Thanks

A query is a string so you can use an IF statement or something to string it together properly.

 

Well, I'm good to go when I know all three values, but my problem is loading the options into the select based on the make, and likewise, loading, the available years based on make and model. Or did I not understand what you were saying?

 

An example would be the menu on the left of this site: http://www.jcwhitney.com/

 

This site uses javascript, but I was kind of hoping it wouldn't be too much of a problem with php.

 

Thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.