- ASP - Database Table Display
·Script Writers
·Database Display
·Response Objects
·Server Variables
·Random Events
·What's New?
Mail List


Multiple Form Selection
Allowing multiple choices of data elements enables people to customize views of your data and adds value to your applications. The following example utilizes our db on the career statistics of Hammeriní Hank Greenberg. The year and team he played with are already part of the sql request to the db. User inputted choice(s) are added to the basic sql statement to draw them from the db. Since the input from the dropdown menu comes through comma delimited it is simply written into the statement without modification. Two simple for next loops determine which elements are part of the record set and displays them accordingly.
View the Output
Text View
Print View
Mail this Link
Download the Code
View the Data

<title> Form Selection)</title>
<body bgcolor="#FFFFFF">
<%' Check to see if there is any input
' if not display the form for input
if u_input = "" then %>

<form action="<%= request.servervariables("script_name")%>" method="post">
Select One, Many, or All elements to display<br>
<select size="5" name="u_input" multiple>
<option value="AVG">AVG</option>
<option value="AB">AB</option>
<option value="R">R</option>
<option value="H">H</option>
<option value="Double">Double</option>
<option value="Triple">Triple</option>
<option value="HR">HR</option>
<option value="RBI">RBI</option>
<option value="BB">BB</option>
<option value="SO">SO</option>
<option value="SB">SB</option>
<input type="submit" value="Submit">

<%' When there is input display the data
' Name of the Access db

' Connection to the db
cn="DRIVER={Microsoft Access Driver (*.mdb)};"
cn=cn & "DBQ=" & server.mappath(accessdb)

' Create a server record set object
set rs = server.createobject("ADODB.Recordset")

' Create an sql statement that will select the elements Year, Team
' and any user inputtted selections. A single selection will simply
' add that element to the list. Multiple selections will be passed
' already comma delimited. The sql statement is written to the browser
' to demonstrate this. 
sql = "select Year, Team, "& u_input &" from hammerin_hank " 

' Execute the sql 
rs.Open sql, cn

<table border=3 align=center>
<caption><%= sql%><tr>
<% ' Write out all the elements requested in the 
' sql statement as table headers
for each element in rs.fields%>

<th><%= %></th>
<% next
' End table headers %>

<% ' Write out all the values in the record 
do while not rs.eof 
for each element in rs.fields %>

<td align=right><%= rs( %></td>
' end of record %>

<% ' Move to the next record
' Loop to the beginning

<% end if 'End check for user input %>




ASP: What's New? | Articles | Script Writers | Database Display | Read/Write
Server Variables | Response Objects | Random Events | Miscellaneous
HTML: Forms | Hyperlinks | Headers | Tables | Hyperlinks | Headers | Text Display
JavaScript: Document Info | Forms | Images | Navigation | Script Writers
CSS: Basics | Page Display | Text Display | Script Writers | Miscellaneous
  • 2014 michael kors
  • air max women 2013
  • 2014 michael kors
  • air max 2014
  • oakley glasses
  • oakley glasses

  • Maps: Map Script Writers | Bing Maps | Google Maps
  • bottes fr
  • ugg boot
  • Privacy Statement is hosted by
    Donate Food Online with a Mouse Click at
    Donate Land Online with a Mouse Click at
    © 1999 - 2018
    All Rights Reserved

  • Kids jordan 6 rings
  • Jordan retro 10
  • Jordan retro 3