Re: $_SESSION $_POST

From: Markus Ernst (derernst_at_NO#SP#AMgmx.ch)
Date: 09/27/04


Date: Mon, 27 Sep 2004 16:00:03 +0200

mammothman42@hotmail.com wrote:
> ahhh! fully confused! so should i be using SESSION variables or POST?

Sorry for confusing you with a joke. For using forms it is essential to know
the ways data get transmitted from the form to the server. See the very
useful overwiew Simon Stienen gave you in his answer.

> That is, how is this kinda thing usually done? i'm sure it's a fairly
> common problem.

Not a problem, just common.

> should i submit the form as SESSION, or is this a
> security flaw?

No it was a joke. You have to use POST or GET.

> it seems stupid using post, and then having to copy,
> one by one, the variables to SESSION. doesn't seem "right".

If you want a shortcut to get all your postdata into the $_SESSION array:

// This puts the post data at the end of the $_SESSION array:
$_SESSION = $_SESSION + $_POST;

// As an alternative, this will overwrite already existing entries with the
same keys in the session data:
$_SESSION = array_merge($_SESSION, $_POST);

But usually you will not want this, as you want to process the posted data
rather than store it into the session.

HTH
Markus



Relevant Pages

  • Re: asp question about post vars
    ... you are somewhat like a joke yourself. ... A simple question as none of the books I have answer it. ... but you have to be careful about Session Timeouts. ... >> applications that were written in php with an ASP alternative. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: More non progress :-)
    ... Another session in the shed Doug? ... There's a really obvious joke to be cracked there. ... But I'm not one to lower the tone like that. ...
    (uk.rec.cars.modifications)
  • Re: $_SESSION $_POST
    ... so should i be using SESSION variables or POST? ... how is this kinda thing usually done? ... common problem. ...
    (comp.lang.php)
  • Re: More non progress :-)
    ... Another session in the shed Doug? ... There's a really obvious joke to be cracked there. ... But I'm not one to lower the tone like that. ...
    (uk.rec.cars.modifications)
  • Re: More non progress :-)
    ... Another session in the shed Doug? ... There's a really obvious joke to be cracked there. ... But I'm not one to lower the tone like that. ...
    (uk.rec.cars.modifications)