You can read our introductory tutorial on Select Case if you haven't done so already.
Here's an example using Select Case and a form. Below is the code for two pages, 'select.asp' and 'choice.asp'. On the first page 'select.asp' you will have the choice to select a meat type.
Once you select that meat type and click submit, the details will be posted to 'choice.asp' and your selection will determine what is displayed on 'choice.asp'. The values sent in the form select box called 'selectMeat' will be captured and assigned to a variable called TypeOfMeat in 'choice.asp', i.e. TypeOfMeat=Request.Form("selectMeat") . It's at this point we use Select Case to determine what to display depending on the value chosen, sent and received.
Select.asp
<html>
<head><title>Using Select Case</title></head>
<body>
<form name="form1" method="post" action="Choice.asp">
<select name="selectMeat">
<option value="chicken">chicken</option>
<option value="turkey">turkey</option>
<option value="ham">ham</option>
</select>
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>
Choice.asp
<%
TypeOfMeat=Request.Form("selectMeat")
SELECT CASE TypeOfMeat
Case "chicken"
Response.write "You selected chicken."
Case "turkey"
Response.write "You selected turkey."
Case "ham"
Response.write "You selected ham."
'It's possible that none of the case statements
equal the value of TypeOfMeat
'so in this scenario - use Case Else
Case Else
Response.write "There was no selection made."
END SELECT
%>
Get the best asp web hosting provider now and save 30%
Plug and play ASP membership script that integrates with PayPal to let you charge recurring membership fees.