passing variable in from 1 asp file to another

passing variable in from 1 asp file to another

am 05.01.2007 04:50:36 von LetMeDoIt

Greetings,
there are tons of examples of how to pass a variable from one asp file
to another in this group, and yet I cannot seem to get that right.
Seems that the variable that I'm passing is always blank in the
destination file. Any help is greatly appreciated. Here's my logic:

In file SetVar.asp, I'm passing a variable named assetVar.
In file ReadVar.asp I'm trying to read that variable. This is where I
having the issue. Note that in ReadVar.asp, I'm using the 3 Request
calls for lack of knowing better.

The code for setting the variable is in SetVar.asp:





target="detail">BOAT


....

The code for reading the vairiable is in ReadVar.asp and follows:
<%
Dim strSearch
strSearch = Request.Form( "assetVar" )
Response.Write ( "Request.Form: " & strSearch & "
" )

'strSearch = Request.QueryString( "assetVar" )
Response.Write ( "Query.Form: " & strSearch & "
" )

'strSearch = Trim(Request( "assetVar" ))
Response.Write ( "Query.Form: " & strSearch & "
" )
%>

Re: passing variable in from 1 asp file to another

am 05.01.2007 10:10:39 von Anthony Jones

"LetMeDoIt" wrote in message
news:1167969036.457306.224300@s34g2000cwa.googlegroups.com.. .
> Greetings,
> there are tons of examples of how to pass a variable from one asp file
> to another in this group, and yet I cannot seem to get that right.
> Seems that the variable that I'm passing is always blank in the
> destination file. Any help is greatly appreciated. Here's my logic:
>
> In file SetVar.asp, I'm passing a variable named assetVar.
> In file ReadVar.asp I'm trying to read that variable. This is where I
> having the issue. Note that in ReadVar.asp, I'm using the 3 Request
> calls for lack of knowing better.
>
> The code for setting the variable is in SetVar.asp:
>
>


>

>
> target="detail">BOAT
>

>

Not sure why you place the anchors above inside a form element. As it is
the form element is doing nothing at all

> ...
>
> The code for reading the vairiable is in ReadVar.asp and follows:
> <%
> Dim strSearch
> strSearch = Request.Form( "assetVar" )
> Response.Write ( "Request.Form: " & strSearch & "
" )

strSearch is blank because there is no form post in progress only a GET for
the URL:-
ReadVar.asp?assetVar=CAR OR ReadVar.asp?assetVar=BOAT

>
> 'strSearch = Request.QueryString( "assetVar" )

If you uncomment this line the strSearch would be CAR or BOAT since the
assetVar is in the querystring.

Re: passing variable in from 1 asp file to another

am 11.01.2007 16:03:27 von Daniel Crichton

LetMeDoIt wrote on 4 Jan 2007 19:50:36 -0800:

> Greetings,
> there are tons of examples of how to pass a variable from one asp file
> to another in this group, and yet I cannot seem to get that right.
> Seems that the variable that I'm passing is always blank in the
> destination file. Any help is greatly appreciated. Here's my logic:
>
> In file SetVar.asp, I'm passing a variable named assetVar.
> In file ReadVar.asp I'm trying to read that variable. This is where I
> having the issue. Note that in ReadVar.asp, I'm using the 3 Request
> calls for lack of knowing better.
>
> The code for setting the variable is in SetVar.asp:
>
>


>

>
> target="detail">BOAT
>

>
> ...
>
> The code for reading the vairiable is in ReadVar.asp and follows:
> <%
> Dim strSearch
> strSearch = Request.Form( "assetVar" )
> Response.Write ( "Request.Form: " & strSearch & "
" )
>
> 'strSearch = Request.QueryString( "assetVar" )
> Response.Write ( "Query.Form: " & strSearch & "
" )
>
> 'strSearch = Trim(Request( "assetVar" ))
> Response.Write ( "Query.Form: " & strSearch & "
" )
> %>
>

In a form post, variables will be in the .Form collection. However, you're
using URLs (the form tags are a complete waste of time as you have no form
elements), so the variables will be in the QueryString collection. If you'd
uncommented the two lines in your ReadVar.asp code you'd have seen this.
Drop the form tags, change your code to use Request.QueryString, and it'll
work fine.

Dan