By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,367 Members | 1,281 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,367 IT Pros & Developers. It's quick & easy.

passing variables from first page to third

P: n/a
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.
Jul 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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" <Li*********@juno.com> wrote in message
news:fa**************************@posting.google.c om...
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.

Jul 19 '05 #2

P: n/a
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!
Jul 19 '05 #3

P: n/a
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" <li*********@juno.com> wrote in message
news:eI**************@tk2msftngp13.phx.gbl...
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!

Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.