Jump to content

Keep variables across pages without sessions


SDraconis

Recommended Posts

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

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

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.

[quote]you can also post it from page to page...[/quote]
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?
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.