Jump to content

Sessions and Forms


lead2gold

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]

Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.