Passing parameters between asp pages in Frontpage

Posted on 2004-04-05
Last Modified: 2013-12-24

I am working on an advanced search using FrontPage, dropdown boxes, and the Database Results Wizard.

If you go to you can see exactly what I"m dealing with.

On the first page (called ResortSearch.asp) I have a dropdown box from which the user selects a 'ResortName'.  They are then taken to a page (called ResortResults.asp) displaying the database results region that contains all the matching results.  

If the user clicks an "advanced search" hyperlink they are then taken to a page (called ResortAdvancedSearch.asp) where they (hypothetically) narrow their search down by selecting from dropdown boxes for 3 fields:  Bedrooms, Bathrooms, and PriceRange.  I want the resort name to be 'remembered' from the previous page.  After clicking 'submit' they will then taken to a page (called AdvancedResortResults.asp) that shows the records that match all 4 fields (ResortName, Bedrooms, Bathrooms, and PriceRange).

The "advanced search" link appears below the table with each result.  (I don't know how to do a link with parameters if it is NOT in the database results region.) To 'remember' the ResortName I currently have the "Advanced Search" hyperlink parameters set to this:

Name:  ResortName
Value:  <%=FP_FieldHTML(fp_rs,"ResortName")%>

ResortAdvancedSearch.asp currently has its Advanced Form Properties set equal to the same thing (making ResortName a hidden field, I believe.  It doesn't necessarily need to be hidden though.)

Right now it's not working.  What do I need to do to fix it?  

In summary, I want the ResortName to be passed to the ResortAdvancedSearch.asp and then to AdvancedResortResults.asp along with Bathrooms, Bedrooms, and PriceRange.

Thank you very much for any assistance.
Question by:sluthfool
  • 4
  • 4
LVL 12

Expert Comment

ID: 10765217
You are already capturing the value (resortname) in a querystring so this makes it very easy.

At the top of the ResortAdvancedSearch.asp (after <html>) enter the following:

<% varResort = request.querystring("ResortName") %>

Now in your form add a drop-down box called ResortName and in the value enter


This will take care of the problem with passing the data to the ResortAdvancedSearch.asp page but I need more information on the AdvancedResortResults.asp page (this page generates an error).

Note: You have an error on the ResortAdvancedSearch.asp page on line 48.

Author Comment

ID: 10766844
Okay, so that did help.  I am now successfully passing "ResortName" from ResortResults.asp to ResortAdvancedSearch.asp.  (You can see what it does now by following the original link.)

However, I am not able to successfully pass the 4 fields (ResortName, Bedrooms, Bathrooms, and PriceRange) to AdvancedResortResults.asp.

Here's all the information:  For each of the four dropdown boxes on ResortAdvancedSearch.asp I have the 'submit value' (from the DRW) set to the corresponding field.  (I.e. Bedroom submit value is Bedroom.)  The Any Option choice comes from the Drop Down box properties with a specified value of "%" (without the quotes).  That *should* function as an 'allow any value in this dropdown box'.

In AdvancedResortResults.asp the SQL (from the code) is set to:

SELECT * FROM qryForWeb WHERE (ResortName =  ::ResortName:: AND Bathrooms =  ::Bathrooms:: AND Bedrooms =  ::Bedrooms:: AND PriceRange =  ::PriceRange::) ORDER BY DateEntered DESC

If you would like to look at the page a good 'ResortName' to pick is "Westgate Lakes Resort" as it has hundreds (thousands?) of matches.

If I'm leaving anything out that you need to know please tell me.  I'll reply quickly.  Thank you very, very much for the assistance.

LVL 12

Expert Comment

ID: 10767281
Try changing the SQL query to read:

SELECT * FROM qryForWeb WHERE (ResortName =  '::ResortName::' AND Bathrooms =  '::Bathrooms::' AND Bedrooms =  '::Bedrooms::' AND PriceRange =  '::PriceRange::') ORDER BY DateEntered DESC

Leaving the single quotes out tells the query to look for numbers vice text.  

If you want to pass wildcards I recommend adding a choice to each drop down (bathroom, bedrooms, pricerange) for Any Option like you have and then check the specify value option and leave the default there. Switch to html mode and remove Any Option from between the quotes (after option value=) so it looks like:

<select size="1" name="Bedroom">
 <option value="">Any Option</option>
 <option>1 BR</option>
 <option>2 BR</option>

Then I would modify the query to look like:

SELECT * FROM qryForWeb WHERE (ResortName =  '::ResortName::' AND Bathrooms LIKE '::Bathrooms::%' AND Bedrooms LIKE '::Bedrooms::%' AND PriceRange LIKE '::PriceRange::%') ORDER BY DateEntered DESC

This will return the results you desire.

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

LVL 12

Expert Comment

ID: 10769592

Not sure what you are trying on the ResortAdvanceSearch page but it looks like you need to perform a group by query to limit the values returned. It looks like you are letting FP build a drop down for you by drawing from your database.

If this is the case try editing your SQL code in HTML view (the gray code) and modifying your sql to look like:

SELECT ResortName FROM qryForWeb WHERE (ResortName =  '::ResortName::') GROUP BY ResortName ORDER BY ResortName ASC

Just a recommendation on what I saw.


Author Comment

ID: 10769894
I'm working on it now... give me a few minutes and I'll let you know what's going on.


Author Comment

ID: 10770164
I changed the ResortAdvancedSearch.asp code for ResortName to match yours (SELECT ResortName FROM qryForWeb WHERE (ResortName =  '::ResortName::') GROUP BY ResortName ORDER BY ResortName ASC
).  However, now the dropdown box isn't showing ANY values.  I'm not sure why that is.  Previously, the ResortName dropdown box was displaying all ResortName values in a dropdown box with the ResortName from the previous linked page automatically selected.  

As for the other dropdown boxes (Bedrooms, Bathrooms, PriceRange) they are supposed to show all values that are contained in qryForWeb where ResortName = ResortName.  This seems to be working.  (If there is a blank value in the dropdown box (as there is when using Westgate Lakes Resort) for Bedrooms, Bathrooms, or PriceRange it is because there is a record in the database matching the ResortName where that value was left blank.)

I changed the AdvancedResortResults.asp code to this as you recommended:
SELECT * FROM qryForWeb WHERE (ResortName =  '::ResortName::' AND Bathrooms LIKE '::Bathrooms::%' AND Bedrooms LIKE '::Bedrooms::%' AND PriceRange LIKE '::PriceRange::%') ORDER BY DateEntered DESC

I do really appreciate your help.  Any suggestions on what to do next?


Author Comment

ID: 10770189
Oh, and I don't quite understand the SQL code for AdvancedResortResults.asp that I changed it to.  

Bathrooms LIKE '::Bathrooms::%'

What exactly does that do/mean?  

LVL 12

Accepted Solution

rcmb earned 75 total points
ID: 10770871
For some reason the querystring is not being passed to the page.

Try this query and see how it works:

SELECT ResortName FROM qryForWeb GROUP BY ResortName ORDER BY ResortName ASC

This will make sure we are drawing all of the information.

If this works then try:

SELECT ResortName FROM qryForWeb WHERE (ResortName =  '::ResortName::') ORDER BY ResortName ASC

A quick way to test if the querystring is being passed is to enter the following at the top of the page and see if it displays

<% var1 = request.querystring("ResortName") %>
<% = var1 %>

If you see the Resort Name passed from the previous page then you have what you need and we can proceed from there.

As for Bathrooms LIKE '::Bathrooms::%' what is does is put a wild card at the end of the value you pass.

For instance if you passed 2 it may return 2 BR, 2 XX, 2 whatever

It means begins with whatever you pass and you do not care what it ends with.

You need to modify the drop down boxes from this:
<option selected value="%">Any Option</option>

to this:
<option selected value="">Any Option</option>

The sql query has the % in it and with the blank in Any Option you get all regardless because everything begins with nothing - if you get what I mean.


Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: : Go t…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question