You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
889 B
Plaintext

<form method="post" action ="<%= Request.ServerVariables("SCRIPT_NAME") %>" >
<input type ="text" name="age"><br>
<input type="submit">
</form>
<%
Dim strAge , intAge , blnValid
If Request.ServerVariables("CONTENT_LENGTH") <> 0 Then
strAge = Trim(Request.form("age"))
'if strAge is a number then we go on
If isNumeric(strAge) Then
'convert strAGe to an integer
intAge = CInt(strAge)
' if age is between 1 and 120 then success
If 1<= intAge and 120 >= intAge Then
blnValid = True
End If
'if a number is entered then display this
Else
Response.Write "You didnt enter a valid number<br>"
End If
'if you have a valid number then display a message
If blnValid = True Then
Response.Write("Your age is " & intAge)
'if number is invalid then display a different message
Else
Response.Write("Enter an age between 1 and 120 ")
End If
End If
%>