[thelist] iterating over two-dimensional arrays
Ashley Graham
ph33rful at optonline.net
Mon Jul 5 16:43:12 CDT 2004
> foreach ($styles as $foo) // iterates through each set of sub-arrays in
> the array
> {
> echo <select name="$foo[$key];
> $arraylen = count($foo); // checks size of the current sub-array
> for($i = 0; $i < $arraylen; $i++)
> { // iterates through each entry within the sub-array
> echo <option name="$foo[$i]">$foo[$i]</option> // writes your
> option statement
> }
> echo </select>;
> }
I can't seem to get the
> echo <select name="$foo[$key];
to echo anything--I've modified it so that it runs, adding the needed
quotation marks and everything. I don't get any errors, it simple echoes
nothing.
Any suggestions?
On another note the rest of it works like a charm. Thanks for the help
so far.
More information about the thelist
mailing list