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.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    May 2007
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Passing an ERROR string to next page??? HELP?!?

    I am using ASPemail (http://aspemail.com) on a site, and I can get it to work fine when the form posts back to itself. My "sucess" statement shows just fine when I register on the site, and my email goes through perfectly.

    But what I want to do is display a different page (other than the same form page) with either a "thank you" dialog or the printout of the error message should there be one.


    I can't figure out how to reference the error string ("strErr") to the confirmation.asp page. I've put the script, exactly as on the "register.asp" page, in the confirmation.asp page and it doesnt work. In fact, when the form is submitted it redirects to confirmation.asp, but the page is not displayed at all.

    Is there an easy way to pass a variable that is NOT set in the form itself (i.e. just a variable of the page)?

    I've tried using <% = Request("strErr") %>, <% =strErr %>, etc., and nothing works. In the register.asp page it is simply <% =strErr %>.

    Can anyone help? All of the code needed can be found at the site above.

    Thanks alot

  • #2
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Use session variables.

    All variables are destroyed upon page completion except Session and Application. Application variables are available to EVERYONE, while Session variables are for that particular person.

    So, for you, set session("strErr") = strErr. Then, on your Confirmation page, use <%= session("strErr") %> when needed.

    When you are done using it, use Session.Contents.Remove("strErr") OR session("strErr") = "".

    These will destroy the session variable.

    HTH!
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #3
    New Coder
    Join Date
    May 2007
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the reply.

    I was trying to avoid having to use session state, since this is just a registration form and nothing too complex.

    But if I were to do what you said, where would I put the session("strErr") = strErr?

  • #4
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    If you want to keep variables persistent across pages, you have no choice but to use session variables (that is, unless you really want to hate life and put the strErr into a hidden HTML input field and then use the Request object. yuk...)

    May I safely assume that this thread is similar/related to this thread?
    Contact form

    If so, then here's what you are looking for:

    On your Register.asp :

    Code:
    session("strErr") = ""
    session("bSuccess") = False
    On Error Resume Next ' catch errors
    Mail.Send	 ' send message
    If Err <> 0 Then ' error occurred
    	session("strErr") = Err.Description
    else
    	session("bSuccess") = True
    End If
    On your Confirmation.asp :

    Code:
    <body>
    
    <% If session("strErr") <> "" Then %>
    <h3><div align="center"><FONT COLOR="#FF0000">Error occurred: <I><% = strErr %></I></FONT></div></h3>
    <% 
    Session.Contents.Remove("strErr")
    End If %>
    
    <% If session("bSuccess") = true Then %>
    <h3>
    <div align="center"><FONT COLOR="#00A000">
    Thank you for registering, <% =Request.Form("name") %>!
    </FONT></div>
    </h3>
    <% 
    Session.Contents.Remove("bSuccess")
    End If %>
    
    </body>
    If you are still having issues with it, just let us know!
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #5
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,065
    Thanks
    4
    Thanked 8 Times in 8 Posts
    Are you talking about having the form on pageA submit to pageB and then if there is an Error on pageB have that move to pageC? If that is the case include the error in a hidden form field and use javascript and the pageload event to handle the movement from one page to another. or if you are moving using Response.Redirect then put the error in the querystring and simply request it once on pageC.

    If there is no 3rd page involved then you do not need to pass it to the next page since this is the page you are on!!!.

    Read my reply in the other thread.
    Last edited by miranda; 08-01-2007 at 07:58 PM. Reason: typo


  •  

    Posting Permissions

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