How to set a response redirect to go back one page

Hi

I have a form which has a response redirect at the end. I'd like this to go back one page (ie the page before the form page) can I do this with javascript?

Thanks

The code of the form is

if (Request.Form("Submit")) = "Submit" then
		emailmsg = ""
		for each thing in request.form
			emailmsg = emailmsg & trim(thing) & ": " & trim(request.form(thing)) & vbcrlf 
		next	
		set msg = Server.CreateOBject( "JMail.Message" )
		msg.Logging = true
		msg.silent = false
		msg.From = request.form("email")		
		msg.AddRecipient "sales@"			'Recipient of emailed form
		msg.Subject = "Stock enquiry"					'Subject of Email
		msg.Body = cstr(EmailMsg)
		msg.Send( "" ) 			'Change this to www2, www3 etc
		response.redirect "thank_you_mail.asp"				'address of thank you page
	end if

Open in new window

swordfishsoupAsked:
Who is Participating?
 
thirdConnect With a Mentor Commented:
hmm, the code snippet portion is new. ok here,

 
<input type="hidden" name="redirPage" value="<%=Request.ServerVariables("http_referer")%>">
 
 
 
then on your page
 
response.redirect Request("redirPage")

Open in new window

0
 
hieloCommented:
You can send this javascript snippet to the client:
<script type="text/javascript">
top.location.href= "http://www.yourdomain.com/yourpageBeforetheForm.asp?x=1&y=2";
</script>

where x and y are "variables" you may wish to pass onto the page before the form.
0
 
thirdCommented:
my advice is to put the referrer on a hidden form field. then use this to redirect to your previous page.
0
 
swordfishsoupAuthor Commented:
Fantastic, works a treat.

Thanks very much 'third'

Dave
0
 
thirdCommented:
welcome. ;-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.