PDA

View Full Version : Redirect Script


Dean
09-23-2002, 01:26 PM
Hi there

I hope someone can help me.

I am trying to make a redirect page that will check if a session varible exsists and if it does then to redirect to this session variable. but if this session is blank to redirect to this other url.

I have a feedback form that runs over 3 pages that you can choose out out of a list who you send the email to and this form submits using formmail. i have the redirect value set to a page auto submits on loading and this sends a copy of the original form submitted to a different email address. like a CC.

the thing is becuase you can chose who you email the first form to i only want to have the auto submitting page to appear on the first time the user goes through the forms.

I have the auto submiting page setting a session when it is loaded to the value of the thank you page.

So what i am trying to do is set the first redirect url that formmail will point the browser to after the first email is sent to is a page which will check if there is a url in the session variable "Next" and if there is then redirect to it and if not then to redirect to the url for the auto submitting page.

sort of like these to bits of script joined together.

<%
If Request.Session("Next") = "" Then
Response.Redirect("dot.asp")
End If
%>
<%
Response.Redirect(cStr(Session("Next")))
%>

Any sugestions welcome:confused:

raf
09-23-2002, 01:39 PM
quite an explanation.

or you trying to do this:


<%
If len(Session("Next")) = 0 Then
Response.Redirect("dot.asp")
else
Response.Redirect(cStr(Session("Next")))
end if
%>



When the sessionvariable is still empty, you go to dot.asp. If somthing was stored in the session-variable (an url or filename), go there. (Do you need the cString ?)
(Make sure you create an empty sessionvariable when the session starts)

Dean
09-23-2002, 01:48 PM
Hi raf

Thanks a lot for that it does exactly what i am after for this job.

I feel the more info i give if i am barking up the wrong tree with the direction i am going it easier for someone to know what i need and so give the right advice. but looking above i did repeat myself a bit though hey? ha ha

Not to worry thanks for the help.:thumbsup: :thumbsup:

raf
09-23-2002, 02:14 PM
no problem. it's not easy explaining that sort a things.
(for that purpuse, i'm planning on building a sort of workshop-site where people can post this sort of question and then follow the programming to get the code that answers their question. plans, plans, plans, ...)

Dean
09-23-2002, 02:35 PM
hi raf

that sounds a good i idea.

I use ultradev 4 and it builds a lot of the code for you as you probally know but i still end up changing a lot of it for what i want it to do rather than what it was supposed to do.

I am getting quite good but if i have not seen something similar it is hard to know exactly what goes where. Sometimes half an idea of what it should look like can be worse than idea as i have spent many a afternoon going in the wrong direction and the next day coming back and thing this isn't working what about this and trying something totally different and getting it to work.

I find this forum very useful and the people on here great at pointing me in the right direction.

I am glad i found it.

You'll have to let me know the url for that site if you put it up.

best of luck:thumbsup: :thumbsup:

raf
09-23-2002, 02:55 PM
dean,

i'll keep you informed. as soon as i found a good (and free) host, i start experimenting. (as you probably guessed, this app will start small and will grow by answering more and more questions until it developpes into a real app.) i'll need some people with ideas/questions without sollutions to keep goïng.

Dean
09-30-2002, 02:32 PM
Good luck on finding a good free host.:thumbsup:

I finally got the site i was working on finished.
Thanks for the help:thumbsup: