LetMeDoIt wrote on 4 Jan 2007 19:50:36 -0800:
[quoted text, click to view] > 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:
> <body>
> <form method="POST" >
> <br><a href="ReadVar.asp?assetVar=CAR" target="detail"><b>CAR</b></a>
> <br><a href="ReadVar.asp?assetVar=BOAT"
> target="detail"><b>BOAT</b></a>
> </form>
> </body>
> ...
>
> The code for reading the vairiable is in ReadVar.asp and follows:
> <%
> Dim strSearch
> strSearch = Request.Form( "assetVar" )
> Response.Write ( "Request.Form: " & strSearch & "<br>" )
>
> 'strSearch = Request.QueryString( "assetVar" )
> Response.Write ( "Query.Form: " & strSearch & "<br>" )
>
> 'strSearch = Trim(Request( "assetVar" ))
> Response.Write ( "Query.Form: " & strSearch & "<br>" )
> %>
> </body>
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