Jump to content


Photo

Sessions and Forms


  • Please log in to reply
1 reply to this topic

#1 lead2gold

lead2gold
  • Members
  • PipPipPip
  • Advanced Member
  • 164 posts
  • LocationOttawa, On

Posted 28 July 2006 - 05:30 PM

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:
Posted Image



#2 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 28 July 2006 - 05:54 PM

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.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users