Jump to content

Archived

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

SDraconis

Keep variables across pages without sessions

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.

Share this post


Link to post
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.

Share this post


Link to post
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?

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.