View Single Post

  #2 (permalink)  
Old 02-20-2007
Németh Zoltán
 
Posts: n/a
Default Re: [PHP] Understanding session variables with input field andregister_global

2007. 02. 20, kedd keltezéssel 17.32-kor Otto Wyss ezt Ã*rta:
> I've an input field in a form
>
> <input name="username" type="text" ...
>
> and with register_global I can use this field in PHP as variable
> $username. Yet if I use a session variable
>
> $_SESSION['username'] = 'value'
>
> the variable $username gets the same value.


the manual says ( http://hu.php.net/manual/en/ref.session.php )
"If register_globals is enabled, then the global variables and the
$_SESSION entries will automatically reference the same values which
were registered in the prior session instance. However, if the variable
is registered by $_SESSION then the global variable is available since
the next request."

that's why it is the same
I think you should read the value from $_POST and put it into $_SESSION
to change it

hope that helps
Zoltán Németh

> On the other side when I
> enter a value in the input field, the session variable isn't changed. So
> how can I set the session variable from the input field after it has
> changed?


>
> O. Wyss
>

Reply With Quote