Pages: [1]
Print
Author Topic: Help pass ASP variables in URL  (Read 765 times)
0 Members and 1 Guest are viewing this topic.
Excel Computing
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 8


View Profile
« on: August 06, 2009, 04:42:18 PM »

Hi

Some websites have pairs of pages, where page 1 will display user-interaction like 'drop-down menus', and then page 2 will show different reults, depending on the option chosen on page 1.

For example the drop-downs at http://www.brigantia.com/locate.asp

In PHP I have passed URL variables by putting things like this at the end of the URL:

&var=123&name=john

How can I craft a URL that will pass the drop-down menu values for the example ASP site?

Thanks, Excel


Logged
Seo'ers - UK SEO, Internet Marketing and Webmaster Forums
« on: August 06, 2009, 04:42:18 PM »

Recommended SEOers Resources

3 months free Web Hosting from 123-reg!
 Logged
caravan
Global Moderator
Major
*****

Karma: +10/-0
Offline Offline

Posts: 589



View Profile WWW
« Reply #1 on: August 07, 2009, 01:08:20 PM »

If I understand you correctly it's the same as with php. You pass the parameters in the url querystring eg. locate.asp?var=123&name=john. Then on the receiving page (locate.asp) you'll collect those querystring parameters using:

<%
strvar = request.querystring("var")
strname = request.querystring("name")
%>

if the parameters are being sent by a form then use

<%
strvar = request.form("var")
strname = request.form("name")
%>

or if you're lazy for both options

<%
strvar = request("var")
strname = request("name")
%>

will work
Logged

Excel Computing
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 8


View Profile
« Reply #2 on: August 11, 2009, 09:44:00 PM »

I have tried the question mark thing on the end, and also looked up the HTML form 'unput' field names and values.

Field names are:         postcode        membertype

So I made this url, but to no avail?

http://www.brigantia.com/searchresults.asp?postcode=HA5&membertype=8

Is it possible this page just won't accept URL variables?

Thanks
Logged
HHI Golf Guy
Global Moderator
Major
*****

Karma: +12/-2
Offline Offline

Posts: 912



View Profile
« Reply #3 on: August 12, 2009, 02:43:45 AM »

OK - dumb question. Did you query the database?

I know nothing about ASP, but it seems to me you need to query the database first before you can parse results.
Logged

caravan
Global Moderator
Major
*****

Karma: +10/-0
Offline Offline

Posts: 589



View Profile WWW
« Reply #4 on: August 12, 2009, 09:34:12 AM »

Lets say on page1.asp you have the form below:
Code:
<form action="page2.asp" method="post" name="input">
        <input type="text" name="postcode" size="4" maxlength="4" /></td>
<select name="membertype">
<option value="1">Accredited Computer Experts</option>
<option value="2">Office Partner Associates</option>
<option value="8">Other Channel Businesses</option>
<option value="">All</option>
</select>
</form>

using the form post method you'll need to send the form to page2.asp

At the top of page2.asp collect the form information into variables with:
Code:
<%
strpostcode = request.form("postcode")
strmembertype = request.form("membertype")
%>

next check the information is being passed by printing out the results using:
Code:
<%
response.write("strpostcode = " & strpostcode & ", strmembertype = " & strmembertype )
%>

If this works you'll then need to place these variables (strpostcode and strmembertype) in your sql query. As HHI Golf guy says you need to collect the results before you can query the database.
Logged

Excel Computing
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 8


View Profile
« Reply #5 on: August 15, 2009, 05:27:10 PM »

Thank you again.

Please understand, the Brigantia site in question is not my site, I can't contorl the background code.

I am simply trying (if possible) to craft a URL for the site that will pass those variables, and display the pages I want from the URL.

Thanks.

Excel
Logged
Pages: [1]
Print
Jump to:  


Related Topics
Subject Started by Replies Views Last post
Heading you guys off at the pass!
Break Room
BabyChicken4u2 4 268 Last post July 12, 2007, 02:48:10 PM
by BabyChicken4u2