Hi i hope someone can give me a good example of point me in the direction of where i need to start.
I’m creating a fairly basic Car Sales website, i have all the design in place and all Cars and details being pulled from database. I would like to create a Search whereby it displays firstly all Manufacturers in a drop down, then subject to manufacturer it can be filtered by model, then by min price > max price, year etc etc all of these details are loaded in the database and obviously i have worked out how to display the necessary details but i’m really stumped with searching and filtering … I am an absolute noob, so i am hoping someone could give me a simple mysqli example.

Greatly appreciated.

It’s difficult to give an example without seeing the table design and data.

Hey thanks for your reply, i’m not sure exactly what you need but i basically have a table with fields “make”,“model”,“price”,“year”, example Ford Mustang 27,000 1967 … What i want is a drop down with every “make” with the model field empty until a make is chosen at which point a model can be chosen or not, so a minimum search choice of make … with the option to choose a model and/or filter by price min / price maximum and year …
I hope i have given you enough information to atl east point me in the right direction, i sincerely appreciate any help.



Ideally you would want to maintain a separate table that contains “makes” then link your “models” to a “make_id”

Do you know JavaScript or worked with AJAX before?

Ah ok … unfortunately, maintaining a separate table isn’t really an option as the table is being loaded from a csv feed and i don’t really want a pre-populated table of makes as, the feed changes daily and i only want to show makes & models that actually exist, so i’m not sure how i would go about assigning the make_id.

With regards to Java & Ajax … i haven’t really worked much with them, but i assume that’s how the model field would be fetched without refreshing the page …

I wonder is there an existing script that could be modified.

After reading around and learning a little bit of terminology … maybe i can expand a little bit more clearly on what i require … I don’t need the full search results to be updated with ajax, actually i think the only part which needs updated with ajax id the “model” field.

So SELECT DISTINCT make FROM table; will produce my first drop down of Vehicle Make.

Basically from there i need my second drop down to produce a list of “model” where the “make” is equal to drop down 1. This bit needs to be generated with ajax, but at that point a search button will produce the results in a new page.

Ideally prior to Searching i would like price min, price max & year filters as optional … but at this stage i would be happy just to have the “make” & model part working …

I don’t know if that makes any more sense, but appreciate any help.


Sponsor our Newsletter | Privacy Policy | Terms of Service