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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying a passed variable between ASP pages 1

Status
Not open for further replies.

credo

Programmer
Jul 26, 2001
50
0
0
GB
Hello,
I have a " Villa details" web-page that shows details of villas from a database using ASP (the results set is called rs_av). Some of the information being shown is on 'availability of the villa for a certain week'.

If the villa is available for a certain week, I write a "book" link using:

<% If (rs_av.Fields.Item("w1_Avail").Value = True) Then
Response.Write "<a href='book.asp?"&MM_keepURL&"'>Book</a>"

..and this works ok, by passing the villaId (in MM_keepURL function) to the book.asp web page.

I want to display the Villa details on the book.asp page in an HTML form and one of the pieces of information I would like to show is the week the user has selected.

To do this I have set a variable "w" eg.

<% If (rs_av.Fields.Item("w1_Avail").Value = True) Then
Response.Write "<a href='book.asp?w=1&"&MM_keepURL&"'>Book</a>"

on hovering over the book link, I get (eg. for Villa 25)

on the book.asp page I now want to show the week selected in the form text field ... I'm using

<% If (w="1") Then Response.Write rs_av.Fields.Item("w1_Avail").Value %>

I'm having trouble with the passed variable "w" - how do I pick this up in the book.asp page


thks again in advance for any pointers
Credo
 
try

<% if request.querystring("w") = "1" Then ...

The value isn't passed directly as a variable, you are only passing it in the URL. You then have to use request.querystring to extract it from the URL

To get a form value you would use request.form("fieldname")


Steve Davis
hey.you@hahaha.com.au

Me? I can't even spell ASP!
 
w = request("w")
This works too.

rsshetty.

It's always in the details.
 
that's true, but if you know whether it is a form or querystring it can be a waste of resurces as it forces the server to check both.

Sure, it is only minor, but in the interests of better coding, it is good practise to specify .form or .querystring

Steve Davis
hey.you@hahaha.com.au

Me? I can't even spell ASP!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top