Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Response.Redirect 1

Status
Not open for further replies.

g2000

Programmer
Aug 31, 2005
39
US
When using response.redirect(" ")...can I pass in some variables?

2 files, input.asp(w/ inputs) & output.asp

I use response.redirect("output.asp") in input.asp
but how to pass the variables from input.asp to output.asp???

Thank you





 
should look something like this for multiple variables...

Response.Redirect "yourpage.asp?input1=" & val1& "&input2=" & val2

you can go on add as many variables as you want and separate them using &

-DNG
 
thanks.. but... what if the output.asp accepts post? I mean
inside the output.asp.

Request.Form("input1")
 
then on output.asp you should have...

request.querystring("input1")

but if you want request.post("input1") on output.asp...

then you need to have some hidden values on your input.asp page so that they can be collected on output.asp using request.form

<input type="hidden" value="somevalue" name="input1">

-DNG
 
that's exactly what I tested before.. but... it seems it can't grab any value from input.asp...

they are all empty by the way
 
can you post some code...so that we can see where the problem is??

-DNG
 
You can't send "post" (form) values using response.redirect. If the posted values are in the original request you can use server.transfer to another url on the same site.

Other than that you will need to construct a post request using the XMLHTTP object.

Chris.

Indifference will be the downfall of mankind, but who cares?
Woo Hoo! the cobblers kids get new shoes.
People Counting Systems

So long, and thanks for all the fish.
 
thanks guys.. this is an extract

input.asp
<html>
<% if isDate(Request.Form("txt1")) then
response.redirect("output.asp")
end if %>
<body> <form method=post id="webForm" action="input.asp">
<input type="text" value="" id="txt1" /></form>
</body></html>

output.asp
<html><body>
<input type="text" value="<% request.Form("txt1") %>" />
</body></html>

See? I need to do some operation such as data checking before posting to output.asp. Anyway, thanks guys...
 
you are missing = sign in output.asp page...

<input type="text" value="<%[red]=[/red]request.Form("txt1") %>" />

-DNG
 
same thing.. i even put that on top of the page just like
output.asp
<html><body>
<%=request.Form("txt1") %>
</body></html>
 
where is the submit button i dont see one...

input.asp
Code:
<html>
<% 
if request("submit")<>"" then
if isDate(Request.Form("txt1")) then
      response.redirect("output.asp")
   end if 
end if
%>
<body> 
<form method=post id="webForm" action="[red]output[/red].asp">
<input type="text" value="" id="txt1" />
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>

output.asp
Code:
<%
response.write request.form("txt1")
%>

you were having a wrong action page...

-DNG
 
again.. i copied and pasted them and tested it ..... it doesn't work.. anyway thanks DNG
 
damn...now i know the reason...silly mistake....

<input type="text" value="" [red]name="txt1"[/red] id="txt1" />

now try the code i provided with the above change..

-DNG
 
i mean this one...

input.asp

Code:
<html>
<% 
if request("submit")<>"" then
if isDate(Request.Form("txt1")) then
      response.redirect("output.asp")
else
response.write "sorry thats not a date"
   end if 
end if
%>
<body> 
<form method=post id="webForm" action="">
<input type="text" value="" name="txt1"id="txt1" />
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
output.asp

Code:
<%
response.write request.form("txt1")
%>

-DNG
 
i missed a space in the code...also you can try this...

input.asp
Code:
<html>
<% 
if request("submit")<>"" then
if isDate(Request.Form("txt1")) then
      response.redirect("output.asp?txt1="&request.form("txt1"))
else
response.write "sorry thats not a date"
   end if 
end if
%>
<body> 
<form method=post id="webForm" action="">
<input type="text" name="txt1" id="txt1" />
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>

output.asp
Code:
<%
response.write request.querystring("txt1")
%>

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top