If the answers to the 390 inputs are all limited in length, you *might* be
able to squeeze them all into POST variables carried forward from page to
page.
What you need to realize here is that HTTP is stateless -- The browser and
server won't remember anything unless you work at it.
So, on each page, you need to dump out all the variables collected so far as
<INPUT TYPE=HIDDEN fields in your FORM to be carried forward to the next
page.
That, of course, is going to get ugly pretty fast, and the sheer size will
work against you -- Servers are encouraged not to limit the size of a POST,
or at least to give it astronomically high limit, but they *can* limit it to
something like 1K of data and still be "in spec".
So, your next attractive option is to use PHP's new session management:
<?php
session_start();
session_register('var1');
session_register('var2');
#etc for each var the form is accepting.
?>
Even this, however, could get ugly under heavy load -- storing all that data
using standard file I/O could be too much slow disk I/O. Fortunately, you
can swap in MySQL or other database as the storage mechanism for your
server-side PHP session data. See
http://php.net/manual/en/function.session-set-save-handler.php for complete
details, but the basic idea is this:
Alter php.ini to tell PHP you are using a user-defined/database storage
mechanism rather than the built-in file one.
Write a function for the five or six things a session data set can have done
to it. (Read/Write/Create/Delete/...)
The session_set_save_handler() function takes the names of these functions,
and alters PHP so it calls them instead of the builtin ones.
Hope that helps.
Oh yeah: Probably moot now, but I think the rand() function needs some
arguments to do what you wanted it to do... And it's not a real good choice
for a unique user_id anyway. uniqid() is way mo' betta', or using the
builtin session stuff, of course.
----- Original Message -----
From: Larry Jaques <[EMAIL PROTECTED]>
Newsgroups: php.general
Sent: Sunday, January 14, 2001 7:45 PM
Subject: [PHP] variable tracking overview
> Could someone give/sell me a clue as to variable tracking and/or cookie
> usage over multiple form pages
> for multiple users?
>
> Environment: website
> Number of variables: 390 or so.
> I have 4 pages of forms, 4 result pages, and want to email all the
results.
> I put up one page of forms, they input, it spits the output to the result
> page.
> Each input/output works fine until the final output which comes up totally
> empty.
>
> This session tracking code (hopefully) heads the input pages
> <?
> if (!isset($id)) {
> srand((double)microtime()*1000000);
> $randval = rand();
> setcookie("id",$randval,time()+14400,"/",".mywebpage.com",0);
> }
>
> ?>
>
> It is shown as echo "Your session number is $id"; which shows up on every
> page except the first.
>
> If I link the email output page to the first input page form, it outputs
> the INFO SENT
> html page and the email with all of the page info, so that part is
working.
> It just doesn't
> track across several forms and if two people are logged in concurrently,
> the same
> session id number is used for both users. Arrrrrrrrrrrgh!
>
> What am I missing here?
>
> Should I be creating a database for this one-time-use info?
>
>
> (Of course, the client dragged his feet for 5 months and now needs to get
> it rolling
> yesterday. I would appreciate any help ASAP.)
>
> Thanks.
>
> Larry
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]