Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > passing variables from first page to third

Reply
Thread Tools

passing variables from first page to third

 
 
t-ball
Guest
Posts: n/a
 
      08-01-2003
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.
 
Reply With Quote
 
 
 
 
Tom B
Guest
Posts: n/a
 
      08-01-2003
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: 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.



 
Reply With Quote
 
 
 
 
Tricia Castrogiovanni
Guest
Posts: n/a
 
      08-01-2003
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!
 
Reply With Quote
 
Tom B
Guest
Posts: n/a
 
      08-01-2003
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!



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
embed a third party's page in my page CreativeMind ASP .Net 0 08-29-2010 07:03 PM
Put variables into member variables or function variables? tjumail@gmail.com C++ 9 03-23-2008 04:03 PM
Need an exact definition of First, Second, Third Line Support M MCSE 6 10-17-2007 11:44 AM
How to know the date is first,second,third weeks... weetat Java 3 08-14-2007 01:21 PM
How to know the date is first,second,third weeks... weetat Java 1 08-13-2007 09:02 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57