Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- Getting infro from array


Marked - 4:24 am on Feb 20, 2010 (gmt 0)


I'm sure this is simplest thing ever... I have an array, I want to get info from using foreach(if possible). Using the print_r function, the array looks like this:
Array
(
[Mm] => Array
( [0] => darkone.png
[1] => forestone.png
[2] => metalone.png
[3] => parchmentone.png
[4] => redwood.jpg
)
[Nm] => Array
(
[0] => ci_teal.jpg
)
[Am] => Array
(
[0] => back.jpg
[1] => backvx.jpg
[2] => backxp.jpg
[3] => simplegreen.jpg
[4] => simplered.jpg
)
)


Basically what I am trying to do is list the first section of the array(Mn,Nm and Am), and then underneath list their values. Like so:
Mn
-darkone.png
-forestone.png
-metalone.png
-parchmentone.png
-redwood.jpg
Nm
-ci_teal.jpg

And so on. They will actually be made into a select field in a form, but I can do that once i have access to them from the foreach loop or whatever.

So I was wondering how to do this. I was trying to do it in a foreach loop but with no success.

Thanks in advance,
Mark.


Thread source:: http://www.webmasterworld.com/php/4083791.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com