Click to See Complete Forum and Search --> : Redirect


petrod
04-09-2004, 01:14 PM
I have this code:
%>
<TR>
<TD><%my_link=scriptresponder & "?which=" & rstemp(idfield)%>
<FORM><input type=button onclick="window.location.href='<%=my_link%>';"value="Go to"></td>
<TD><%=objRS ("TITLE") %> </TD>
<TD><%=objRS ("AIRLINE") %> </TD>
<TD><%=objRS ("OFFICE") %> </TD>
<TD><%=objRS ("CODE") %> </TD></TR>
<%
This code shows a button and 4 rows form the database.When u click on the button it will go u a page
redirect.asp?which=www.cyprusair.com.cy
What code should i put in the redirect page so that i can read the part after the which= and redirect meto the correct page.

buntine
04-09-2004, 01:46 PM
Mate, this is the fundamentals of ASP...

You will need to use the QueryString collection. The following code will return its value.

dim strWhich
strWhich = CStr(Request.QueryString("which"))

Regards,
Andrew Buntine.

petrod
04-09-2004, 02:16 PM
I have done this code:
<%
Response.Buffer = True
%>
<HTML>
<BODY>
<%
dim strWhich
strWhich = CStr(Request.QueryString("which"))

If 1 = 1 Then
Response.Clear
Response.Redirect strWhich
End If
%>
<%
Response.End
%>
</BODY>
</HTML>
But the reulst i get is this one
http://127.0.0.1/QUANTAS%20AIRWAYS
How it supposed to find this thing when my page is quantasairways.asp
What iam doing wrong.

buntine
04-09-2004, 02:30 PM
If 1 = 1 Then
Response.Clear
Response.Redirect strWhich
End If

WHAT!!?!!??!

If 1 = 1!! Why are you checking that? The answer will always be true.. Its completely pointless.

You dont need and HTML elements on this page and the response.end method is not needed.

I think you need to learn the basics of ASP, buddy. It seems you have no idea whats going on.

Regards.

crh3675
04-10-2004, 09:39 PM
You are redirecting to a variable. That makes no sense. The value you receive from the Querystring should have some sort of method attached to it. Such as:


<%

strWhich=Request.QueryString("which")
If strWhich="QUANTAS AIRWAYS" Then
strLoc="http://some_url_to_quantas"
End If

Response.Redirect strLoc
%>

buntine
04-11-2004, 12:09 AM
crh3675: The querysString variable already contains a valid url...

But he is right, you are not sending the URL value through the queryString, you are sending the title.