Forums

This topic is locked

variable in response.redirect

Posted 10 Dec 2002 09:33:22
1
has voted
10 Dec 2002 09:33:22 Jelle-Jacob de Vries posted:
Can I put a variable reguested from the qeurystring in the response.redirect string?
I want to use this for the multiple delete with checkboxes tutorial on this site!
I want the delete page to redirect back to the detailpage it came from.

Could someone gif any suggestions, the variable that I want to reguest is ?cat_ID=.....
I'm not really a handcoder you know !


here's my code:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<!--#include file="../Connections/FMF.asp" -->
<%
Dim strDeleteList
strDeleteList = Request.Form("delete"
If strDeleteList = "" Then

Response.redirect "delete1.asp"

Else
set Command1 = Server.CreateObject("ADODB.Command"
Command1.ActiveConnection = MM_FMF_STRING
Command1.CommandText = "DELETE FROM Info_FMF WHERE ID IN (" & strDeleteList & " "
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()

set Command1 = Nothing

Response.redirect "delete.asp"

End If

%>


Thanks in advance

Replies

Replied 11 Dec 2002 09:39:58
11 Dec 2002 09:39:58 Vince Baker replied:
<% Response.write("nameofyourpage.asp?cat_ID=" & strVariableName)%>

If you just want to return to the previous page and keep the same URL variables that existed use the following code:

<%
Dim strPreviousPage
strPreviousPage = Request.ServerVariables("HTTP_REFERER"
Response.Redirect(strPreviousPage)
%>

Regards
Vince

Response.write("The best line of code you can ever use"

VBScript | ASP | HTML | SQL | Oracle | Hosting
Replied 15 Dec 2002 21:51:26
15 Dec 2002 21:51:26 Jelle-Jacob de Vries replied:
Thanks Vince but is not working yet,

could you have a look at my code and see what I'm doing wrong?

<%
Dim strDeleteList
strDeleteList = Request.Form("Verwijder"
If strDeleteList = "" Then

Response.redirect("verwijder1.asp?cat_ID=" & strVariableName & "&valid=false"

Else
set Command1 = Server.CreateObject("ADODB.Command"
Command1.ActiveConnection = MM_FMF_STRING
Command1.CommandText = "DELETE FROM Info_FMF WHERE ID IN (" & strDeleteList & " "
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()

set Command1 = Nothing

Response.redirect "verwijder3.asp"

End If

%>
Replied 16 Dec 2002 12:54:18
16 Dec 2002 12:54:18 Vince Baker replied:
Sorry but I didnt explain the variable very well.

Send the cat_id from the previous page in the URL and then Request.QUerysrting and set a variable. (Where I put the strVariableName that should be replaced by the variable you created)

i.e.

<% 'Obviously you must send the Cat_ID from the previous page in the URL
Dim strID
strID = Request.Querystring("Cat_ID"
%>

<% Response.write("nameofyourpage.asp?cat_ID=" & strID)%>

Try that

Regards
Vince

Response.write("The best line of code you can ever use"

VBScript | ASP | HTML | SQL | Oracle | Hosting
Replied 16 Dec 2002 22:39:23
16 Dec 2002 22:39:23 Lee Diggins replied:
Hi jellejacob,

try using the QUERY_STRING server variable - "Query information stored in the string following the question mark (?) in the HTTP request." as well as the HTTP_REFERER.

Digga

Sharing Knowledge Save Valuable Time!!!

Reply to this topic