Jump to content

Archived

This topic is now archived and is closed to further replies.

lead2gold

Sessions and Forms

Recommended Posts

Hi guys,

I just got a general question...


I have a form that will have many display lists that you add/remove to using <input type="button">

Step 1:
I want to be able to populate many fields with potentionally many resubmits to the same form as information gets added/removed.

Step 2:
Finally once everything is set up the way one might want, they can hit the big save  button at the bottom which will process all the information they entered and insert it into the database.


Now, generally a normal form only consists of Step 2.... do your error checking; if all is good, then preform the DB insert.
But the form i need to build will have many little [add] buttons everywhere that will keep small amounts of information to a table (i will store as an array).

I was thinking.... would it be safe/ok to just save everything to $_SESSION.  And when the final Save is pressed, i just parse through the $_SESSION and preform my inserts?

Here is a sample of a form i did up quickly in an image editor of what i intend to make:
[img]http://rideaubuslines.lead2gold.org/deleteme/route-a.JPG[/img]

Share this post


Link to post
Share on other sites
That looks like it would be safe, just don't specify a time in the php.ini and if defaults to when the browser closes.  So you just close the browser after your done to kill the session, if you specify a time, then 2 things can happen.
1. it can delete your sessions before you are even finished with what you are doing.
2. if it's set too high it can make it to where if there is a lot of time left over after you close the browser someone could hijack the sessiona nd finish doing what you started, or work on what you were working on, leaving it to default makes it clear as soon as you close the browser.  Other than that it should be safe.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.