We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Passing parameters between asp pages in Frontpage

sluthfool
sluthfool asked
on
Medium Priority
234 Views
Last Modified: 2013-12-24
Hi,

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

If you go to http://www.resortequitymarketing.com/Listings/ResortSearch.asp 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.
Matt
Comment
Watch Question

Commented:
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

<%=varResort%>

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).
RCMB


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

Author

Commented:
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.

Matt

Commented:
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>
 </select>

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.

RCMB

Commented:
sluthfool,

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.

RCMB

Author

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

Thanks.
Matt

Author

Commented:
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?

Matt

Author

Commented:
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?  

Matt
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.