another good way is to use an associative array $session[] as your only
session variable, that way you don't need to worry abopout session variables
overwriting local or vice versa, so $value as a session variable becomes
$session["value"]
Tim Ward
Senior Systems Engineer
Please refer to the following disclaimer in respect of this message:
http://www.stivesdirect.com/e-mail-disclaimer.html
> -----Original Message-----
> From: Plutarck [mailto:[EMAIL PROTECTED]]
> Sent: 12 April 2001 13:24
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Updating a value in a session
>
>
> What happens is when you use session_start(), all variables
> in the session
> become initialized to the values they have previously been given.
>
> So when you call session_start the second time, a variable
> named $value is
> created with the value it was given earlier.
>
> The problem is, it over-writes the variable $value which was
> submitted in
> the form.
>
> The way to get around this is to rename your form to
> "form_value". Then
> right after you register value in your session, insert this:
>
> $value = $form_value;
>
> It should work without error.
>
>
> --
> Plutarck
> Should be working on something...
> ...but forgot what it was.
>
>
>
> ""Tobias Talltorp"" <[EMAIL PROTECTED]> wrote in message
> 9b431b$fau$[EMAIL PROTECTED]">news:9b431b$fau$[EMAIL PROTECTED]...
> > On my first page I have a form that posts a value to page2
> where it gets
> > registered in a session. Works like a charm...
> > When I try to do this again, but send another value, the
> session doesn´t
> > update the new value.
> > Why?
> >
> > PAGE 1 --->
> > <form action="page2.php" method="post">
> >
> > <input type="text" name="value" size="30">
> > <input type="submit" name="submit">
> >
> > </form>
> >
> >
> > PAGE 2 --->
> > <?
> > session_start();
> > session_register("value");
> > ?>
> >
> > Thanks,
> > // Tobias
> >
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
> >
>
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]