Re: Updating a value in a session

From: Date: Thu, 12 Apr 2001 12:23:46 +0000
Subject: Re: Updating a value in a session
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-48289@lists.php.net to get a copy of this message
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"" <tobias@talltorp.com> wrote in message news:9b431b$fau$1@toye.p.sourceforge.net... > 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: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#48289) next »