Jump to content


Photo

Keep variables across pages without sessions


  • Please log in to reply
3 replies to this topic

#1 SDraconis

SDraconis
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 16 September 2006 - 10:46 PM

For those familar with JSP or Java Servlets. there is a way to bind an object to an HTTPRequest using setAttribute and then forward this request to another page (most often used when you have separate pages for data processing and data presentation).  I was wondering if there was an equivalent to this in PHP.  So far, the only thing I've found that keeps data across different pages is sessions.  I am fairly familiar with using sessions, and I know specifically that I do not want to use them in this case.

#2 mainewoods

mainewoods
  • Members
  • PipPipPip
  • Advanced Member
  • 685 posts
  • LocationMaine

Posted 16 September 2006 - 10:54 PM

the only other ways are cookies, url parameter passing, and hidden form field passing.  that's the only ways any of us have.  all the ways of maintaining state on the web require extra coding and all can have potential page breaking ideosyncracies. Maintenence of state on the web sucks and it is not going to change anytime soon.

#3 markbett

markbett
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts

Posted 16 September 2006 - 11:07 PM

you can also post it from page to page...

#4 SDraconis

SDraconis
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 16 September 2006 - 11:22 PM

Since the data is an actual PHP data structure, URL parameter passing is out.  The page that's doing the processing is pure PHP without any HTML output, which then sends it's result to another page (conditionally).  In that case, hidden form field passing also is out.  What's the difference between cookies and sessions?  Coming from a Java Servlet background, I've been led to believe that cookies are just what's used to keep track of sessions.

you can also post it from page to page...

I am not quite sure what you mean.  When I have my processing page redirect to my presentation page, I thought all data stored in $_POST is lost?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users