Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IF and using an AND command

Status
Not open for further replies.

Jimuniguy

Technical User
Mar 6, 2002
363
GB
Hi,

Ok, what I am trying to do is that each page has a unique nummber on it. If (in the query string) the "agent" is on, and the number is correct, I want it to do an include. However, it fails to work, why???

Code:
<%
Dim varAgentnumber
varAgentnumber =1
%>
<%
IF Request.QueryString(&quot;Agent&quot;) =&quot;On&quot; AND Agentnumber =1 then
<!-- #include virtual=&quot;Agent/Page1.htm&quot; -->
ELSE
END IF
%>

Can someone point out my errors!

Thank you

James
 
You are declaring a variable called varAgentnumber but your If statement is checking a variable called Agentnumber.
Tony
reddot.gif WIDTH=300 HEIGHT=2 VSPACE=3

 
Hi,

Yes i know, i changed that, it still does not work.

Any thoughts why?

Cheers

James
 
Ahhhh, your include line should be outside of the ASP script

Code:
<%
If Request.QueryString(&quot;Agent&quot;) =&quot;On&quot; AND Agentnumber =1 Then
  Response.Write &quot;<!-- #include virtual='Agent/Page1.htm' -->&quot;
End If
%>

OR...

<%
If Request.QueryString(&quot;Agent&quot;) =&quot;On&quot; AND Agentnumber =1 Then
%>
  <!-- #include virtual=&quot;Agent/Page1.htm&quot; -->
<%
End If
%>

First is more efficient as it is only one trip to the ASP scripting engine Tony
reddot.gif WIDTH=300 HEIGHT=2 VSPACE=3

 
Arrrrrg Thankyou, stupid me, i missed that one!

Cheers Fester

James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top