Learn to use IF statements in your asp with vbscript. This tutorial will teach you If End If quickly.
If Statements
Many times we need to perform an action or display something different based on
some different parameters. Using If ElseIf End If is one such way to do this.
Lets say you have a three different choices in a dropdown box named choices. For
example a user will choose either 1, 2 or 3. Now based on the selection they
make you want to show three different tings. An easy way to do this is in the
code below:
<%
Dim whichOne
'here we are getting the number from the dropdown
whichOne = Request.Form("choices")
If whichOne = 1 Then
'if whichOne is one we do this
Response.Write "You selected one"
ElseIf whichOne = 2 Then
'if whichOne is two we do this
Response.Write "You selected two"
ElseIf whichOne = 3 Then
'if whichOne is three we do this
Response.Write "You selected three"
Else
'otherwise we tell them they did not make a choice
Response.Write "You did not make a choice, go back and do so now."
End If
%>
Notice ElseIf is all one word. If you separate them you will get an error. In a
nutshell the page will want you to add an End If for each Else If you have, so
make sure ElseIf is all ONE word!