Current location: Hot Scripts Forums » Programming Languages » PHP » arrays passed via session


arrays passed via session

Reply
  #1 (permalink)  
Old 01-22-06, 07:10 PM
rjwebgraphix rjwebgraphix is offline
Newbie Coder
 
Join Date: Sep 2004
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
arrays passed via session

Trying to figure out how an array is being passed from a session.

This is what I have and what I'm trying to do...

PHP Code:

if (isset($_GET['error']) or isset($_GET['missing']))

{
    foreach (
$_SESSION as $key => $value
    { 
        
$formfield[$key] = $value;  // converts session to $formfield
        
unset ($_SESSION);         // Dumps the session data
    
}

There is an array that is being passed back that looks like this...

$os_version['dos'] = "on";
$os_version['win98se'] = "off";
$os_version['win2k'] = "off";
$os_version['winme'] = "off";

Displaying the $formfield array looks like this...

Array ( [os_version] => Array ( [\'dos\'] => on ) )

How can I use this data brought from a session? The following does not work....

PHP Code:

if ($os_version['dos'] == "on")

{
    echo 
" Dos is on ";

I didn't think it would because the array is actually now $formfield['os_version'] I think.

Any help on using an array brought to page from a session would be helpful.

Thanks,

RJ
Reply With Quote
  #2 (permalink)  
Old 01-22-06, 08:00 PM
mab's Avatar
mab mab is offline
Community VIP
 
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
Here is a recent thread on this -
http://www.programmingtalk.com/showthread.php?t=25146

In searching for the answer for that thread, the problem seemed that you can not create an array session variable directly, but if you have an array you can store it in a session variable and then you can access the session variable as an array.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing Session Arrays DAL PHP 4 01-07-06 05:56 PM
urgent: session timeout occurs unexpectedly in ASP.net seemagaur ASP.NET 3 10-11-05 11:10 PM
Arrays with sub arrays perleo PHP 1 09-30-05 07:15 PM
Session validation sharad JavaScript 1 08-15-05 05:47 PM
SESSION Arrays Jaffizzle PHP 2 05-30-05 02:38 PM


All times are GMT -5. The time now is 06:28 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.