Posted by Jerry Stuckle on 01/14/08 01:53
Kurda Yon wrote:
> I am wandering which way to assign a value to a session variable
> exist. Which of the following examples will work.
>
> Example #1:
> session_start();
> session_register("ex");
> $ex = 2.0;
>
> Example #2:
> In first.php:
> session_start();
> session_register("ex");
> In second.php:
> $ex = 2.0;
>
> Example #3:
> In first.php:
> session_start();
> session_register("ex");
> Load second.php?ex=2.0
>
> Example #4:
> In first.php:
> session_start();
> session_register("ex");
> Go to the second.php via submission of the form on the first.php,
> which contains form-variable $ex.
>
> Example #4 seams not to work? Is it expectable?
>
session_register() has been deprecated. The correct way to do it is to
use the $_SESSION superglobal array, i.e.
session_start();
$_SESSION['ex'] = 2.0;
session_start();
$ex = $_SESSION['ex'];
BTW - there is no direct relationship between 'ex' as an index value,
and $ex as a variable.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|