Jump to content

creating a multi dimensional array


purencool

Recommended Posts

I have four different arrays and I want to place them into a multi dimensional array and

then I want to place it into a Session variable. This is what I have below.How do I do this?

 

when I print_r($_Session) I don't get anything just option[](2);

 

 


$_SESSION ['option']['green'] = array('name '=>'jeff');
$_SESSION ['option']['red'] = array('name '=>'mary');
$_SESSION ['option']['blue'] = array('name '=>'joe');
$_SESSION ['option']['brown'] = array('name '=>'ash');

Link to comment
Share on other sites

I have four different arrays and I want to place them into a multi dimensional array and

then I want to place it into a Session variable. This is what I have below.How do I do this?

 

when I print_r($_Session) I don't get anything just option[](2);

 

 


$_SESSION ['option']['green'] = array('name '=>'jeff');
$_SESSION ['option']['red'] = array('name '=>'mary');
$_SESSION ['option']['blue'] = array('name '=>'joe');
$_SESSION ['option']['brown'] = array('name '=>'ash');

 

1. $_Session is not the same as $_SESSION

2. Where are you doing a print_r(), on the same page as these variable assignments or another page?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.