Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hey guys,

I'm building a car database for Forza 4 on the Xbox 360 and I need some help with making the ASP jump menus. I want the menus to act like a filter basically.

I want the lists themselves to pull the data from the appropriate column in my sql db.

For example, I have a column 'Manufacturer' so I'd want the menu to list out all the manufacturers I entered into the Manufacturers column.

Then for step 2 of the menu, let's say I click on 'Honda' in the manufacturer menu, I want the page to load (or a new page is fine too) where it lists out all the cars (and all the data from the other columns in the db too) that are manufactured by Honda.

I've been looking online for help on how to do this for a week or two with no success. The only thing I found was a javascript where I make my own menu, which works okay, except I have to make a new page for each item in the list (which, after all the filters I want is closing in on like 50 pages).

Here is my current code:

VB
<%@Language="VBScript"%>
<html>
<head>

<script language="javascript" type="text/javascript" >
<!--    hide

    function jumpto(x) {

        if (document.form1.jumpmenu1.value != "null") {
            document.location.href = x
            if (document.form2.jumpmenu2.value != "null") {
                document.location.href = x
                if (document.form3.jumpmenu3.value != "null") {
                    document.location.href = x
                    if (document.form4.jumpmenu4.value != "null") {
                        document.location.href = x
                    }
                }
            }
        }
    }

// end hide -->
</script>

<title>Jump_Ace's FM4 Database</title>
</head>
<%
strSQL = "Select * from Data ORDER BY Make;" 'create SQL string (where clauses etc 
'should be added according to what you would like displayed)

SET DbObj = Server.CreateObject("ADODB.Connection") 'set up the 
'ADO connection
DbObj.Open "DSN=SQL Server","sa","1234" 'open the connection to 
'the database, using DSN - set up the DSN in your control panel
SET oRs = DbObj.Execute(strSQL) 'Execute the SQL statement

' Other Obj's are listed here.....
%>

<style id="Comics_Styles">
	
' Style stuff, yada yada.......
    </style>

<div id="Comics" align=center>

<table align=center cellpadding="0" style='border-collapse:collapse;table-layout:fixed'>
  <tr>
    <td width="5"><img src="images/top_left_corner.png" width="5" height="5"  /></td>
    <td height="5" width="950" bgcolor="#FFFFFF"></td>
    <td width="5"><img src="images/top_right_corner.png" width="5" height="5" /></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"></td>
    <td bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="100" class="style1" rowspan="2"><img src="images/Small White Avatar Transparent Blue.png" width="100" height="67" /></td>
    <td width="725" valign="bottom" class="style1"><h1 class=Title>Jump_Ace's FM4 Database</h1></td>
    <td width="100" class="style1" rowspan="2"><img src="images/Small White Avatar Reverse Transparent Blue.png" alt="" width="100" height="67" /></td>
  </tr>
  <tr>
      <td class="style2">
<form id="form" border="0" name="form" method="get" action="search.asp">
  <input type="text" valign="bottom" name="searchTerm" 
      style="width: 666px; height: 20px;" />
  <input type="submit" name="Submit" value="Search" style="width: 68px" /></form>
 
       </tr>
</table>  

<table align="left" style="width: 201px" ><tr><td align="center" class="Title" 
        colspan="3">
            Filter Options</td>
    </tr><tr><td align="center" class="style10">
         </td>
        <td align="left" class="style9">
            Class:</td>
        <td align="center" class="style13">
             </td>
    </tr><tr><td align="center" class="style10">
         </td>
        <td align="left" class="style9">
<form name="form1">
<select name="jumpmenu1"  önChange="jumpto(document.form1.jumpmenu1.options[document.form1.jumpmenu1.options.selectedIndex].value)">
<option></option>
<option value=filterf.asp>F</option>
<option value=filtere.asp>E</option>
<option value=filterd.asp>D</option>
<option value=filterc.asp>C</option>
<option value=filterb.asp>B</option>
<option value=filtera.asp>A</option>
<option value=filters.asp>S</option>
<option value=filterr3.asp>R3</option>
<option value=filterr2.asp>R2</option>
<option value=filterr1.asp>R1</option>
<option value=filterx.asp>X</option>
</select></form></td>
        <td align="center" class="style13">
             </td>
    </tr><tr><td align="center" class="style10">
         </td>
        <td align="left" class="style9">
            Manufacturer:</td>
        <td align="center" class="style13">
             </td>
    </tr><tr><td align="center" class="style10">
         </td>
        <td align="left" class="style9">
<form name="form2">
<select name="jumpmenu2"  önChange="jumpto(document.form2.jumpmenu2.options[document.form2.jumpmenu2.options.selectedIndex].value)">
<option></option>
<option value=filterabarth.asp>Abarth</option>
<option value=filteracura.asp>Acura</option>
<option value=filteralfaromeo.asp>Alfa Romeo</option>
' More Manufactuers listed here, you get the idea.......
</select></form></td>
        <td align="center" class="style13">
             </td>
    </tr><tr><td align="center" class="style10">
         </td>
        <td align="left" class="style9">
            Drivetrain:</td>
        <td align="center" class="style13">
             </td>
    </tr><tr><td align="center" class="style11">
        </td>
        <td align="left" class="style12">
<form name="form3">
<select name="jumpmenu3"  önChange="jumpto(document.form3.jumpmenu3.options[document.form3.jumpmenu3.options.selectedIndex].value)">
<option></option>
<option value=filterff.asp>FF</option>
<option value=filterfr.asp>FR</option>
<option value=filter4wd.asp>4WD</option>
<option value=filterrwd.asp>RWD</option>
</select></form></td>
        <td align="center" class="style13">
             </td>
    </tr><tr><td align="center" class="style10">
         </td>
        <td align="left" class="style9">
            Country:</td>
    </tr><tr><td align="center" class="style10">
         </td>
        <td align="left" class="style9">
<form name="form4">
<select name="jumpmenu4"  önChange="jumpto(document.form4.jumpmenu4.options[document.form4.jumpmenu4.options.selectedIndex].value)">
<option></option>
<option value=filteraustralia.asp>Australia</option>
<option value=filterfrance.asp>France</option>
<option value=filtergermany.asp>Germany</option>
<option value=filteritaly.asp>Italy</option>
<option value=filterjapan.asp>Japan</option>
<option value=filterkorea.asp>Korea</option>
<option value=filternetherlands.asp>Netherlands</option>
<option value=filterspain.asp>Spain</option>
<option value=filtersweden.asp>Sweden</option>
<option value=filteruk.asp>Great Britan</option>
<option value=filterus.asp>United States</option>
</select></form></td>
    </tr></table>

<%
DO WHILE NOT oRs.EOF
' More DO WHILE NOT's listed here.....

on error resume next
%>

<table valign=top align=left style="width: 589px"><tr valign=top><td colspan="5" 
        style="text-align:center;"><% = "Class:" & oRs16.Fields("Class") & " " & FormatNumber(oRs17.Fields("PI"),0) & " " & "PI" & " " & oRs.Fields("Year") & " " & oRs1.Fields("Make") & " " & oRs2.Fields("Model")%>
</td></tr>
 

    <tr><td rowspan="5" style="text-align:center;" colspan="3"><% Response.Write("<img src=http://i770.photobucket.com/albums/xx341/jump_ace/FM4%20DB/" & oRs3.Fields("Picture") & "L.jpg>" & "</a>")%></td>
        <td style="text-align:right;" class="style5">Speed:</td>
        <td class="style7"><% Response.Write("<table bgcolor=#0099FF width=" & oRs4.Fields("Speed") & "cellSpacing=0 cellPadding=0 border=0><td align=center>" & oRs5.Fields("Speed")*.1) & "</table>"%>
            </td>
    </tr>
 

    <tr><td style="text-align:right;" class="style5">Handling:</td>
        <td class="style7"><% Response.Write("<table bgcolor=#0099FF width=" & oRs6.Fields("Handling") & "cellSpacing=0 cellPadding=0 border=0><td align=center>" & oRs7.Fields("Handling")*.1) & "</table>"%>
        </td>
    </tr>


    <tr><td style="text-align:right;" class="style5">Acceleration:</td>
        <td class="style7"><% Response.Write("<table bgcolor=#0099FF width=" & oRs8.Fields("Acceleration") & "cellSpacing=0 cellPadding=0 border=0><td align=center>" & oRs9.Fields("Acceleration")*.1) & "</table>"%>
        </td>
    </tr>


    <tr><td style="text-align:right;" class="style5">Launch:</td>
        <td class="style7"><% Response.Write("<table bgcolor=#0099FF width=" & oRs10.Fields("Launch") & "cellSpacing=0 cellPadding=0 border=0><td align=center>" & oRs11.Fields("Launch")*.1) & "</table>"%>
        </td>
    </tr>


    <tr><td style="text-align:right;" class="style5">Braking:</td>
        <td class="style7"><% Response.Write("<table bgcolor=#0099FF width=" & oRs12.Fields("Braking") & "cellSpacing=0 cellPadding=0 border=0><td align=center>" & oRs13.Fields("Braking")*.1) & "</table>"%>
        </td>
    </tr>


    <tr><td class="style6" align="center"><% Response.Write(FormatCurrency(oRs14.Fields("Price"),0) & " Cr.")%></td><td align="center"><% Response.Write("<img src=http://i770.photobucket.com/albums/xx341/jump_ace/FM4%20DB/" & oRs15.Fields("Country") & ".png>" & "</a>")%></td><td align="center"><% = oRs18.Fields("Drivetrain")%></td><td style="text-align:center;" 
            colspan="2"><% = FormatNumber(oRs19.Fields("Power"),0) & " " & "HP" & "   " & FormatNumber(oRs20.Fields("Weight"),0) & " " & "lbs." & "   " & FormatNumber(oRs21.Fields("Torque"),0) & " " & "Ft.-Lb. Torque"%></td></tr>

    <tr><td class="style6" align="center"></td><td align="center"></td><td align="center">
         </td><td style="text-align:center;" 
            colspan="2"></td></tr>

<% oRs.MoveNext %>
' More Move next's here.....
<% Loop %>
' More Loop's here.....
<% DbObj.Close 
SET DbObj = Nothing 
%>
' More Obj closing clauses here.....
<br />

</table>
    <td bgcolor="#FFFFFF"></td>
  </tr>
  <tr>
    <td><img src="images/bottom_left_corner.png" width="5" height="5" /></td>
    <td height="5" bgcolor="#FFFFFF"></td>
    <td><img src="images/bottom_right_corner.png" width="5" height="5" /></td>
  </tr>
</div>
</body>
</html>


Thanks in advance guys!


Jerome
Posted
Updated 24-Jul-12 9:41am
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900