Search Search

#1 worldwide
FREE Coding Lessons

since 1996
   THE BEST WAY to learn ASP & Asp.net!
Advertise Here!
click for details
Credits Host:
DiscountASP.net
Server Admin:
The "Team"
Contact Info.
Charles M. Carroll

my Blog

IF statement (by John Kauffman & Charles Carroll)

Very often you must determine what to do next based on user input. This is one of the roles of the IF statement. First we make a form that will ask a user for their first name and last name.

   filename=/learn/test/if.asp

<Test Script Below>


<html><head>
<TITLE>if.asp</TITLE>
</head><body bgcolor="#FFFFFF">
<form action="ifrespond.asp" method=get>
Your First Name<INPUT NAME="FirstName" MaxLength=20><p>
Your Last Name<INPUT NAME="LastName" MaxLength=20><p>
<INPUT TYPE=submit><p><INPUT TYPE=reset>
</form></body></html>

Now we make a asp file that examines their first name and last name after the form is submitted.

   filename=/learn/test/ifrespond.asp

<Test Script Below>


<html><head>
<TITLE>ifrespond.asp</TITLE>
</head><body bgcolor="#FFFFFF">
<%fname=request.querystring("Firstname")
lname=request.querystring("Lastname")
If fname="George" and lname="Washington" then%>
    Hi.<p>You must be the first president!
<%else%>
    Hi!<p>Nice to Meet You
<%end if%>
</body></html>

Chaz Wish List
Tall Tip $5
Grande Tip $20
Venti Tip $39
Tip Jar Thanks
2004 Thanks
2005 Thanks
HUGE Tip -love site