Using Select Multiple List Boxes in an HTX File on IIS

When an HTML form containing a <SELECT MULTIPLE...> tag is used, Internet Database Connector converts the items selected into a comma-separated list; the list can be used in the .idc file just like other parameters. However, because the parameter is actually a list, it is typically only used for SQLSelect statements with an IN clause, as in the following examples.

If the parameter name in the .idc file is enclosed in single quotation marks, each element of the list is enclosed in single quotation marks also. You should enclose the parameter name in single quotation marks whenever the column in the IN clause is a character column or other type in which literals are quoted, for example, dates and times. If there are no single quotation marks around the parameter name, no quotation marks are placed around each element of the list. You should not enclose the parameter name in single quotation marks when the column in the IN clause is a numeric type or any other type in which literals are not enclosed in single quotation marks.

Example Code

The following example shows you how to use HTML to create a form that contains the multiple-choice list box:

<SELECT MULTIPLE NAME="region"> 
<OPTION VALUE="Western"> 
<OPTION VALUE="Eastern"> 
<OPTION VALUE="Northern"> 
<OPTION VALUE="Southern"> 
</SELECT> 

The following example shows you how to use SQL query language in an .idc file to perform a query based on the selection made in the preceding HTML form:

SQLStatement: SELECT name, region FROM customer WHERE region IN ('%region%') 

If the user selected "Northern," "Western," and "Eastern" from the HTML form, the SQL statement would be converted to:

SELECT name, region FROM customer WHERE region IN ('Northern', 'Western', 'Eastern') 

The following example shows you how to use HTML to create a form that contains the multiple-choice list box that uses numeric data.

<SELECT MULTIPLE NAME="year"> 
<OPTION VALUE="1994"> 
<OPTION VALUE="1995"> 
<OPTION VALUE="1996"> 
</SELECT> 

The following example shows you how to use SQL query language in an .idc file to perform a query based on the selection made in the preceding HTML form. Since the form used numeric data, no quotation marks enclose the parameter in the .idc file:

SQLStatement: SELECT product, sales_year FROM sales WHERE sales_year IN (%year%) 

If the user selected "1994" and "1995" from the HTML form, the SQL statement would be converted to:

SELECT product, sales_year FROM sales WHERE sales_year IN (1994, 1995)