Dan Shirah wrote:
> Looking for some direction here.
> 
> I have a form that collects user data.   When an employee opens the form
> they enter in all of the user data for an account, however the account can
> have multiple users so the employee has the option to "Enter another user
> for this account" and they can do this for as many users as the account
> holds.
> 
> What I can't figure out is how to store the first set of user details, have
> the blank form come up again, store the second set of user details, have
> the
> blank for come up again, insert a third set of details and then have all
> three sets submit to the database at the same time.
> 
> Did the make sense?
> 
> Would using a session work to store all this user data for a single
> submission?

Hi Dan,

Although sessions look appealing, you may find that users use the "Back"
button on their browser to return to the previous step, and sessions
won't allow this to work properly.

If you really wish to wait until the third user before saving any of
them, then I would use hidden form fields with the data from the
previous entries.

However, if I were in your shoes, I would probably set up the form to
create the account and save immediately to the database, then add the
other users one at a time.  The end of a request is the perfect time to
save data, as long as you allow editing of the details.  Again, expect
users to use "Back" and make sure that if you do save using a numeric
primary key, that you pre-generate it so that it will still be present
if the user clicks "Back."  This way, you can safely allow editing of
the data by just using an UPDATE query rather than INSERT if the data
already exists.

Also, if you are taking sensitive data, be sure this web form is either
on a firewalled intranet or some other security precautions so that you
don't expose SSNs to the public hacker community.

Hope this helps,
Greg
--
Experience the revolution, buy the PEAR Installer Manifesto
http://www.packtpub.com/book/PEAR-installer

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to