So far as I know the session_register() function accepts only one input.
That could be your array if you wanted.  It would be the same thing as doing
this:

$myarray = array('name' => '', 'price' => '', 'desc' => '');
$_SESSION['myarray'] = $myarray;

Set and/or Access with:
$_SESSION['myarray']['name'];
$_SESSION['myarray']['price'];
$_SESSION['myarray']['desc'];

-Kevin

----- Original Message -----
From: "@ Darwin" <[EMAIL PROTECTED]>
To: "Php-General" <[EMAIL PROTECTED]>
Sent: Tuesday, November 05, 2002 3:05 PM
Subject: [PHP] Need Help With SESSIONS and ARRAYS


> Hello,
>
> In an attempt to override the political anger in this mailing list I will
> tell you that I have already searched through documentations on how to
solve
> the problem I'm having, to the extent of my skills in searching.
>
> Ok, now to the problem. I have an array submitted by a form, such as
> $item['name'], $item['desc'], $item['price'], etc, and I want to register
> only individual items of the array in a session, while still preserving
the
> array structure -- i.e. while not breaking the array into separate
> variables.
>
> It says nothing in the docs, and I am not in front of a box running PHP at
> this particular time to test it, but would it make sense to do something
> like:
>
> session_register("item['name']", "item['price']");
>
> and not have to include the $item['desc'] in the sessions? Sometimes, in
my
> application, I do not want to include the $item['desc']. I want to keep
the
> session alive throughout the script and add more individual array items to
> it as well, such as say $item['height'], $item['width'], etc, while still
> having the choice to exclude some of the array items from being registered
> in the $item session.
>
> I'm not sure if I made any sense here, but if someone can attempt to
answer
> this, I would appreciate it greatly. Thanks in advance.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to