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!

Setting a Variable

Status
Not open for further replies.

Jimuniguy

Technical User
Mar 6, 2002
363
GB
Hi,

If i have this variable that i set:

Code:
<%
Dim Pageref
Pageref =&quot;index.asp&quot;
%>

I now need to set the following:

Code:
<%
Dim variable1, variablestring
variable1 = &quot;Pagref&quot;
variablestring = &quot;?Pageref=&quot; & variable1 %>

but this don't work.

Why? Can someone please fill in the missing gaps?

Cheers

James
 
this should do it - you were assigning variable1 to a string &quot;Pagref&quot; rather then the variable Pageref

Code:
<%
Dim Pageref
Pageref = &quot;index.asp&quot;



Dim variable1, variablestring
variable1 = Pageref
variablestring = &quot;?Pageref=&quot; & variable1 
%>
Tony
reddot.gif WIDTH=400 HEIGHT=2 VSPACE=3

 
Hi,

Cool, it does not produce the error I had before, but if i now do:

Code:
<a href=&quot;ASP/Navtt.asp<%=variablestring %>&quot;>Goto Navtt.asp</a>[code]

It only produces this:
[code]<a href=&quot;asp/navtt/?Pageref=&quot;>Goto Navtt.asp</a>

For some reason it wont do this:

Code:
<a href=&quot;asp/navtt/?Pageref=index.asp&quot;>Goto Navtt.asp</a>

Why not???
 
Nah.

Code:
<%
Dim variable1, variablestring
variable1 = Pageref
variablestring = &quot;?Pageref=&quot; & variable1 
%>

Is in an include file with a whole other host of variables

Why, should that make a difference?

James
 
should be fine as long as the page with this code
Code:
<%
Dim Pageref
Pageref =&quot;index.asp&quot;
%>
is including your include file AFTER you write this code. I am guessing however that this is not the case as your include file is probably declared at the top of the page.

The variable in your include file will be written once when the page is loaded. If there is info required for the building of this variable that is not available when the include file is called then the variable will not be complete - as is the case with your incomplete querystring
Tony
reddot.gif WIDTH=400 HEIGHT=2 VSPACE=3

 
Hi,

Nah i am writing it before.

here is the full include showing where include is:
Code:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>
<%
Dim Pageref
Pageref = &quot;index.asp&quot;
%> 
<!-- #Include file=&quot;ASP/Variables.ASP&quot; -->
<body>
 <a href=&quot;ASP/Navtt.asp<%=variablestring %>&quot;>Goto 
  Navtt.asp</a>
</body>
</html>

Now here is the variables.asp

Code:
<%
Dim variable1, variable2, variable3, variable4, variable5, variable6, variable7, variable8, variablestring

variable1 = Request.QueryString(&quot;choc&quot;)
variable2 = Request.QueryString(&quot;sweet&quot;)
variable3 = Request.QueryString(&quot;car&quot;)
variable4 = Request.QueryString(&quot;type&quot;)
variable5 = Request.QueryString(&quot;cost&quot;)
variable6 = Request.QueryString(&quot;Link&quot;)
variable7 = Request.QueryString(&quot;Agent&quot;)
variable8 = Pageref

variablestring = &quot;?choc=&quot; & variable1 &&quot;&amp;sweet=&quot; & variable2 & &quot;&amp;car=&quot; & variable3 & &quot;&amp;type=&quot; & variable4 & &quot;&amp;cost=&quot; & variable5 & &quot;&amp;Link=&quot; & variable6& &quot;&amp;Agent=&quot; & variable7 & &quot;&amp;Pageref=&quot; & variable8%>

But it still don't work

Can you point out where i am going wrong?

Cheers

James
 
Hi,

Duh, dunno why, but it works now, must have done something wrong earlier but then corrected it.

Sorry for that

Cheers though!

James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top