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

Storing variables in forms and insert to database

P: n/a
Hi all,

Newbie here!!

I have 4 forms(A,B,C,D) and a thank you page for my questionnaire.
People will be redirected to B or C depending on the last question's
answer. B or C will redirect to D after B or C is finished. D then
goes to the thank you page.

I want to get all the answers from A,B/C,D first and then insert all
the answers into the database instead of getting each form's answers
and update the database each time when people click the continue/sumit
button on each page.

The problem is now I'm using 'import_request_variables' to get the
answers from A. It successfully brings all the answers to B/C (I tried
it by using echo), but when I try to get A's answers in D/the thank
you page. It doesn't work (tho I tried to use
'import_request_variables' to get A's answers in D/thank you page ).

So, I would like to know if there's any way to get the answers from A
to D/thank you page through B/C?

Hope the question is not confusing....
Thank you for everyone who answers my question!!

Venus
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Venus wrote:
Hi all,

Newbie here!!
Welcome! enjoy :)
I have 4 forms(A,B,C,D) and a thank you page for my questionnaire.
People will be redirected to B or C depending on the last question's
answer. B or C will redirect to D after B or C is finished. D then
goes to the thank you page.

I want to get all the answers from A,B/C,D first and then insert all
the answers into the database instead of getting each form's answers
and update the database each time when people click the continue/sumit
button on each page.

The problem is now I'm using 'import_request_variables' to get the
answers from A. It successfully brings all the answers to B/C (I tried
it by using echo), but when I try to get A's answers in D/the thank
you page. It doesn't work (tho I tried to use
'import_request_variables' to get A's answers in D/thank you page ).
Hmmm ... so it seems you're not redirecting from A to B/C and from B/C
to D after all, or are you?

If A posts to a redirector script and you do a header() there for B/C
the data from A doesn't automatically show up in B/C. How did you do
that?
So, I would like to know if there's any way to get the answers from A
to D/thank you page through B/C?


You have to save A answers inside B/C.

B/C answers will then include A answers (unchanged)
D will get B/C answers (including A answers) and pass them all to the
"thank you" page.
I'd probably go about that like this (using redirector scripts):

A: normal form, nothing fancy, action to redirector
the redirector will get A answers and pass them on to B/C the way
you are already doing it.
B/C: normal form, action to Dredirector
The form will have a hidden field with the A answers serialized.
The Dredirector will had B/C data to the serialized data and put
that into a hidden field in the D form
D: normal form, action to "thank you" page
"thank you" page gets the D data, which you can unserialize to get
the full A, B/C, D data

http://www.php.net/serialize
http://www.php.net/unserailize
HTH

--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #2

P: n/a

On 31-Mar-2004, fr********@yahoo.com.hk (Venus) wrote:
I have 4 forms(A,B,C,D) and a thank you page for my questionnaire.
People will be redirected to B or C depending on the last question's
answer. B or C will redirect to D after B or C is finished. D then
goes to the thank you page.

I want to get all the answers from A,B/C,D first and then insert all
the answers into the database instead of getting each form's answers
and update the database each time when people click the continue/sumit
button on each page.

The problem is now I'm using 'import_request_variables' to get the
answers from A. It successfully brings all the answers to B/C (I tried
it by using echo), but when I try to get A's answers in D/the thank
you page. It doesn't work (tho I tried to use
'import_request_variables' to get A's answers in D/thank you page ).

So, I would like to know if there's any way to get the answers from A
to D/thank you page through B/C?


You have a couple of choices:

1) You can start a session and store the values in $_SESSION
2) You can put the values from A into B and C as hidden fields ( <input
type=hidden ... )
--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to ja*********@willglen.net (it's reserved for spammers)
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.