Re: use SESSION variable?



..oO(Tim Roberts)

"Twayne" <nobody@xxxxxxxxxxxxxxxxxxx> wrote:

My actual question is: How do I get a POST variable into a session
variable so I can use it in any other page I want to use it in?
Apparently posted variables are only available in the Form page in
the file called by Action=, right? But I'd like to use it in other
places.

There are several ways to do this. A $_SESSION variable is one way, and in
many cases that's the most convenient. However, if you have a bunch of
pages with <form>s that succeed one another, it's also possible to pass
this kind of information as <input type=hidden> variables without the
overhead of a session.

Bad idea. Sessions are made for this. It's the hidden fields that cause
the real overhead on the network and the server:

* The same data has to be transferred back and forth between the server
and the client multiple times, wasting bandwidth.
* You have to re-validate the same data over and over again on every
single form submission, because even hidden fields can be manipulated.

With a session you do it all just once: you receive the data, validate
it, store it in the session and that's it. The overhead caused by the
session handler is not really an issue.

Micha
.



Relevant Pages

  • Re: Going sessionless (and cookie limitations)
    ... that the benefit of using cookies to host all session information rather ... eliminate the traffic going from the web servers to the state server or SQL ... only instead of spawning network overhead behind the firewall ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Raise your hand if you have ever wanted to disable the browsers BACK button
    ... > return to your computer to find that the server has forgotten what you ... With hidden fields, each window has its own state. ... same client and treates each one as a separate session. ... Only send to the client those details that need to be sent to ...
    (comp.lang.php)
  • Re: Need Advice on Viewstate
    ... ViewState and SessionState both exist for good reasons, ... ViewState doesn't take up server ... entire single user Session, ... overhead on the server, as the number of users grow? ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Passing grid data from one page to another
    ... But you mentioned that by using session variables, ... Vasantha ... > This bears some overhead though. ... The data grid on the ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Measuring wait time for openning a new connection
    ... This will cause all open cursors for the session to be ... This overhead isn't measured ... is some measurements done on the logon/logoff time, ...
    (comp.databases.oracle.server)