passing variables from first page to third

Discussion in 'ASP General' started by t-ball, Aug 1, 2003.

  1. t-ball

    t-ball Guest

    I am new to the world of ASP, and at the same time VBscript (also a
    firt time poster).

    I am currently creating a multiple page form where the information on
    the first page needs to be validated. To do this, I have an asp page
    between the 1st and second pages of the form. However, I need to pass
    all of the information from the 1st page to the third (the second page
    of the form) so that all collected information can be sent out in an
    e-mail.

    I thought about doing this with hidden form fields, but I don't know
    if this is possible. I put a form with hidden fields on the
    validation page, but I don't know how to make it forward to the proper
    page after that without a submit button.

    I have also heard of session variables, but I could not find too much
    information on the topic.

    If you know of any ideas or references that will help me, it would be
    greatly appreciated.

    Sorry again that I am such a beginner at this topic.

    Thanks.
     
    t-ball, Aug 1, 2003
    #1
    1. Advertising

  2. t-ball

    Tom B Guest

    Generally, I'd put all of that in one page, that posts to itself.

    Example........


    <%
    Dim sName
    Dim sNameErr
    if Request.Form("postback")="true" then
    if ValidateData() then
    SaveData
    Response.redirect("alldone.asp")
    end if
    end if
    %>
    <Form method=Post Action="thisHerePage.asp">
    <input type=hidden name="postback" value="true">
    Your Name:<input name=Name value=<%=sName%>><%=sNameErr%><br>
    <input type=Submit Value="Save">
    </Form>
    <%
    Function ValidateData()
    bRetVal=true

    'Do validation stuff....
    sName=Request.Form("Name")
    if len(sName)=0 then
    bRetVal=false
    sNameErr="Required Field"
    end if

    ValidateData=bRetVal
    End Function

    Sub SaveData()
    'Save the data somewhere
    End Sub

    %>




    "t-ball" <> wrote in message
    news:...
    > I am new to the world of ASP, and at the same time VBscript (also a
    > firt time poster).
    >
    > I am currently creating a multiple page form where the information on
    > the first page needs to be validated. To do this, I have an asp page
    > between the 1st and second pages of the form. However, I need to pass
    > all of the information from the 1st page to the third (the second page
    > of the form) so that all collected information can be sent out in an
    > e-mail.
    >
    > I thought about doing this with hidden form fields, but I don't know
    > if this is possible. I put a form with hidden fields on the
    > validation page, but I don't know how to make it forward to the proper
    > page after that without a submit button.
    >
    > I have also heard of session variables, but I could not find too much
    > information on the topic.
    >
    > If you know of any ideas or references that will help me, it would be
    > greatly appreciated.
    >
    > Sorry again that I am such a beginner at this topic.
    >
    > Thanks.
     
    Tom B, Aug 1, 2003
    #2
    1. Advertising

  3. I could validate in the on the same page as the first form and redirect
    to the second page of the form (a good idea that I never thought of),
    but then how do I get the data to the second page?

    As I stated in my first post, I will be e-mailing all of the data out,
    so I will need it all in one place at one time. Is there a way I can do
    this with the method you suggested?

    Thanks



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Tricia Castrogiovanni, Aug 1, 2003
    #3
  4. t-ball

    Tom B Guest

    If you take a look at what I posted, you'll notice that if the data is
    validated successfully then the SaveData subroutine is called. Rather than
    saving the data though, you would just send your email in that subroutine.

    Basically the user will hit the same page 2 or more times
    1st time--user enters their information
    2nd time -- page is validated--if it's valid, then it saves the data/emails
    the data then redirect to the "all done" page.
    -- if it's not valid, the initial page is presented again,
    with the error messages.
    3rd and up time -- same as 2nd, if it's valid, save/email, if not, show it
    again.

    Wait a sec......
    Are you saying, that Page1 collects some information, then Page 2 collects
    more information (but different)?
    If so, then you have a couple of choices.
    Choice 1, save all the Page1 data in hidden form fields
    Choice 2, save in Session variables
    Dim sName
    sName=Request.Form("Name")
    if IsValid(sName) then 'some validating script
    Session("Name") = sName
    end if
    then on the third page you retrieve with sName=Session("Name")
    Choice 3, after page 1 is submitted you store the page1 data in a database
    and retrieve on Page 3
    with this method you still need to keep track of the data.
    Again, either with a Session variable or Hidden form field




    "Tricia Castrogiovanni" <> wrote in message
    news:...
    > I could validate in the on the same page as the first form and redirect
    > to the second page of the form (a good idea that I never thought of),
    > but then how do I get the data to the second page?
    >
    > As I stated in my first post, I will be e-mailing all of the data out,
    > so I will need it all in one place at one time. Is there a way I can do
    > this with the method you suggested?
    >
    > Thanks
    >
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    Tom B, Aug 1, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. weetat
    Replies:
    3
    Views:
    302
    Dr J R Stockton
    Aug 14, 2007
  2. weetat
    Replies:
    1
    Views:
    331
    Jacky
    Aug 13, 2007
  3. Supriya

    Third party control on page

    Supriya, Aug 17, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    347
    Supriya
    Aug 18, 2007
  4. CreativeMind

    embed a third party's page in my page

    CreativeMind, Aug 29, 2010, in forum: ASP .Net
    Replies:
    0
    Views:
    446
    CreativeMind
    Aug 29, 2010
  5. sherifffruitfly
    Replies:
    0
    Views:
    127
    sherifffruitfly
    Apr 25, 2007
Loading...

Share This Page