Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post

    response.redirect question

    Hello

    I am wondering why this 'response.redirecte' doesn't work. After clicking 'submit' on my Web form page (contact_us1.asp), the user sees a message that says 'thank you for your message:

    Code:
    <font size="2" color="#000000">Your message as seen below has been sent. Thank You.
    <br><br>
    
    <% =Replace(ContactUs_Body,vbCr,"<br>") %>
    
    </font>
    <% Else %>
    
    <form action="contact_us1.asp" method="post">
    <input type="hidden" name="Action" value="SendEmail">
    Then all the HTML follows.

    But that looks bare because the main brand image at the top, menu, etc does not appear, so I replaced the above code snippet with this:

    Code:
    <% 
    response.redirect("thank_you.asp")
     %>
    
    <% Else %>
    
    <form action="contact_us1.asp" method="post">
    <input type="hidden" name="Action" value="SendEmail">
    ...where thank_you.asp does contain the main image, etc, but my little exercise didn't work - I get redirected to the old 'thank you for your message' contained in the contact_us1.asp file.

    Thanks for any advice.

    Steve

  • #2
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    Hello

    I have managed to sort out the redirection using
    Code:
    <%Response.Redirect("thank_you.asp")%>
    but if I use the form variable for 'name', which is ContactUs_Name it's still not working out.

    Thanks for any advice.

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,196
    Thanks
    75
    Thanked 4,342 Times in 4,308 Posts
    You never bother to show us how or why you are using ContactUs_Name.

    So how can we guess?
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #4
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    Hello Old Pedant

    Thanks for your reply.

    I have
    Code:
    <%Response.Redirect("thank_you.asp")%>
    in the page that holds the contact form and the page does redirect the user to the thank you page, so that part works.

    Ideally, I was hoping to say 'thank you + name' on the 'thank_you.asp' page.

    In my form page I have:

    Code:
    <%
    'Declaring Variables
    Dim smtpserver,youremail,yourpassword,myCopy,ContactUs_Name,ContactUs_Email
    Dim ContactUs_Body,Action,IsError
    	
    
    smtpserver = "smtp.mysite.com"
    youremail = "info@mysite.com"
    yourpassword = "pwd"
    myCopy = "myEmail@.."
    
    
    ' Grabbing variables from the form post
    ContactUs_Name = Request("ContactUs_Name")
    ContactUs_Email = Request("ContactUs_Email")
    ContactUs_Body = Request("ContactUs_Body")
    Action = Request("Action")
    Cheers

    Steve

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,196
    Thanks
    75
    Thanked 4,342 Times in 4,308 Posts
    Trivial.

    Code:
    <%
    Response.Redirect "thank_you.asp?name=" & ContactUs_name 
    %>
    In the thank_you.asp code:
    Code:
    <%
    thename = Request("name")
    %>
    <html>
    ...
    <body>
    <h2>Thank you, <%=thename%>, for your submission.</h2>
    ...
    </body>
    </html>
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #6
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    Hello OP

    Many thanks for your message.

    I am the last one to question you here, but I do not have a variable called 'name'. The name field is not attached to anything called 'name'.

    Maybe I am missing something?

    It's trivial to YOU because you know!

    You take care.

    Steve

  • #7
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    Is there a reason OP why I can see the code in the form fields here:

    http://www.proofreading4students.com/contact_us1.asp

    Thanks again.

    Steve

  • #8
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,196
    Thanks
    75
    Thanked 4,342 Times in 4,308 Posts
    ??? I do not understand your objection/question.

    In the page that *DOES* the Response.Redirect, I am not using any variable called name. I am, indeed, using your contactUs_name. The code is
    Code:
    Response.Redirect "thank_you.asp?name=" & ContactUs_name 
    In your "thank_you.asp" page, I introduced a *NEW* variable called thename, but you can use any variable name you wish. Here:
    Code:
    <%
    zqoo11_vvxy72 = Request("name")
    %>
    <html>
    ...
    <body>
    <h2>Thank you, <%=zqoo11_vvxy72%>, for your submission.</h2>
    ...
    </body>
    </html>
    Does that make you happier?
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #9
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,196
    Thanks
    75
    Thanked 4,342 Times in 4,308 Posts
    Quote Originally Posted by SteveH View Post
    Is there a reason OP why I can see the code in the form fields here:

    http://www.proofreading4students.com/contact_us1.asp
    Sure. Your web server is not set up to handle ASP pages.

    Either you are using a Linux web server, which will never understand ASP, or your Windows Server does not have ASP enabled. (It often is disabled by default in modern IIS systems.)
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #10
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    No, it's an ASP/Windows server/hosting service. They are in the US which is OK, but I don't think they are native English speakers. I have to juggle in my mind what they really mean when I speak to them. I will sort it out.

    Anyway, is this what you mean:

    Code:
    Response.Redirect "thank_you.asp?name=" & ContactUs_name
    in the form page and:
    Code:
    <%
    ContactUs_Name = Request("name")
    %>
    
    h2>Thank you, <%=ContactUs_Name%>, for your submission.</h2>
    But I need to dim 'name' first?

    Sorry for trying your impatience.

    Steve

  • #11
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,196
    Thanks
    75
    Thanked 4,342 Times in 4,308 Posts
    But I need to dim 'name' first?
    Huh? There is NEVER any variable name used in *EITHER* page.

    Sure, you can do
    Code:
       Dim name
    but for what purpose when that variable is NEVER USED?????

    You seem to think there is some magic relationship between:
    -- the name of a variable
    -- the contents (value) of that variable
    -- the name of the querystring element used in Request("name")

    NOTHING COULD BE FURTHER FROM THE TRUTH!

    Yes, the code you show in your post #10 should work.

    But it would work EQUALLY WELL if you did this:
    Code:
    <%
    Response.Redirect "thank_you.asp?freakyfridaykruger =" & ContactUs_name
    %>
    and then
    Code:
    <%
    santaclaus = Request("freakyfridaykruger")
    %>
    
    <h2>Thank you, <%=santaclaus%>, for your submission.</h2>
    VARIABLE NAMES ARE OF YOUR OWN CHOICE. They do NOT need to be related to their contents in any way (though of course it's easier to understand the code if they are). They do *NOT* need to match from one ASP page to the next. They do *NOT* need to match in any way the key in the key=value pair of a querystring. Again, it's usually better if they do, but IT IS ALL UP TO YOU.

    One more working example:
    Code:
    <%
    Response.Redirect "thank_you.asp?x =" & ContactUs_name
    %>
    and then
    Code:
    <%
    v = Request("x")
    %>
    
    <h2>Thank you, <%=v%>, for your submission.</h2>
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #12
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    Thank you again, Old Pedant.

    I will come back once I have sorted out this server thing - I am onto them at this very moment.

    I suppose what I don't understand is how

    freakyfridaykruger

    on one ASP page can see

    santaclaus = Request("freakyfridaykruger")

    unless those pages interrelate. I suppose that happens through 'redirect', doesn't it?

    Steve

  • #13
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,196
    Thanks
    75
    Thanked 4,342 Times in 4,308 Posts
    Quote Originally Posted by SteveH View Post
    I suppose what I don't understand is how

    freakyfridaykruger

    on one ASP page can see

    santaclaus = Request("freakyfridaykruger")

    unless those pages interrelate. I suppose that happens through 'redirect', doesn't it?
    Yes. Except you have it backwards.

    It is the REQUEST("whatever") that must be changed to match the whatever= that is used in the Response.Redirect.

    That is, when I do
    Code:
    Response.Redirect "contact_us.asp?ZZZ=" & ContactUs_Name
    then the contact_us.asp page must change its code to match the ZZZ. Or whatever is used there. The receiver must adapt itself to the sender.

    In point of fact, the receiver *could* be written without knowing what key=value pair the sender is using!!!

    Suppose that I wrote contact_us.asp knowing that the sender was indeed sending me *something* in the querystring, but I didn't know exactly what.

    I could write:
    Code:
    For Each key In Request.QueryString
        Response.Write "I found " & key & " set to " & Request.QueryString(key) & "<br/>"
    Next
    That is, I can iterate through all the Request.QueryString (or Request.Form) key=value pairs to find out what I got sent.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #14
    Regular Coder
    Join Date
    Nov 2005
    Posts
    750
    Thanks
    138
    Thanked 1 Time in 1 Post
    You have explained it very well, thank you.

    I will try to resolve it after this server thing (still on to them).

    Thanks for your patience and great advice. If I don't understand, I will ask again - if that's OK.

    Where are you, by the way? UK here.

    Steve

  • #15
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,196
    Thanks
    75
    Thanked 4,342 Times in 4,308 Posts
    Seattle, Washington, USA. Or at least close to there. 45KM NE of Seattle, actually.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    SteveH (04-23-2013)


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •