To start off, you need three pages, one to list the brands, one to show cars matching that brand, and one more to show you the details of one particular car. Lets call them brandselect.asp, brand.asp, and car.asp
I am not sure how your database is set up but you will either have a table with brands and ids, with each vehicle referring to a particular brand id, or you will just have a 'brand' column in your vehicles table with the brand name in text.
Lets assume its the second option - the brand name as text in the database.
First you need to select all the DISTINCT brands from the database so you get a list of all brands which are used at least once.
The code for brandselect.asp would be something like this
strSQl = "SELECT DISTINCT brand FROM cars ORDER BY brand"
rs.Open strSQL, objCon, 3
If Not rs.EOF Then
Do Until rs.EOF
%><a href="brand.asp?brand=<%=rs("brand")%>"><%=rs("BRAND")%></a><br/><%
rs.MoveNext
Loop
End If
rs.Close
This should list all of the unique brand names one under each other down the page. When you click on one of the names it will go to another page called brand.asp and also send the name of the brand in the querystring.
In brand.asp, you now just need to select a list of vehicles based on the selected brand e.g.
strSQL = "SELECT * FROM CARS WHERE CAR_BRAND='" & Request.QueryString("brand") & "'"
rs.Open strSQl, objCon, 3
If Not rs.EOF Then
Do Until rs.EOF
%><a href="car.asp?car=<%=rs("carid")%>"><%=rs("carname")%></a><br/><%
rs.MoveNext
Loop
End If
rs.CLose
This will draw a list of all cars matching the selected brand, which when clicked will go to a car.asp page which will show the details of that particular vehicle.
In car.asp you then just need to extract the details for that particular car, using the selected id e.g.
strSQL = "SELECT * FROM cars WHERE carid=" & Request.QueryString("carid")
rs.Open strSQL
If Not rs.EOF Then
%>
Car Name : <%=rs("cartitle")%><br/>
Brand: <%=rs("brand")%><br/>
Price: <%=rs("price")%><br/>
etc.. etc..
<%
ENd IF
rs.CLose
In these examples I have assumed that you already have a connection to your database called objCon, and I have just guessed the names of the fields in your database too - these will obviously need to match the real field names.
Hope this is enough to get you started, let me know if you need further help.
Nick (Webmaster)
info@npfx.com