purencool Posted October 14, 2010 Share Posted October 14, 2010 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 https://forums.phpfreaks.com/topic/215850-creating-a-multi-dimensional-array/ Share on other sites More sharing options...
rwwd Posted October 14, 2010 Share Posted October 14, 2010 echo "<pre>"; print_r($_SESSION['option']);<-- needs the index defining I think.. echo "</pre>"; Rw Link to comment https://forums.phpfreaks.com/topic/215850-creating-a-multi-dimensional-array/#findComment-1122076 Share on other sites More sharing options...
purencool Posted October 14, 2010 Author Share Posted October 14, 2010 so the multi dimesional array is correct? Link to comment https://forums.phpfreaks.com/topic/215850-creating-a-multi-dimensional-array/#findComment-1122078 Share on other sites More sharing options...
AbraCadaver Posted October 14, 2010 Share Posted October 14, 2010 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 https://forums.phpfreaks.com/topic/215850-creating-a-multi-dimensional-array/#findComment-1122153 Share on other sites More sharing options...
purencool Posted October 14, 2010 Author Share Posted October 14, 2010 I don't know why I had $_Session instead of $_SESSION thanks that fixed it. Link to comment https://forums.phpfreaks.com/topic/215850-creating-a-multi-dimensional-array/#findComment-1122266 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.