[thelist] iterating over two-dimensional arrays

Ashley Graham ph33rful at optonline.net
Sun Jul 4 21:04:32 CDT 2004


hey,

lets say I have a two dimensional array:

$styles = array(
                'layout' => array('simple', 'clean'),
                'size' => array('small', 'default', 'large'),
                'face' => array('arial', 'verdana', 'trebuchet_ms') 
     	       );

then, let's say I want each "sub"-array to echo out a form element, 
specifically a select/option element, where each of the values of the 
"sub"-array is an option.

an example because I'm almost sure that paragraph didn't make any sense:

<form>
<select name="layout">
	<option name="simple">simple</option>
	<option name="simple">clean</option>
...continue through other sub arrays...
</form>

how do i create this dynamically? how do i make PHP create this form all 
by itself?

I've not followed certain specifications for accessibility and the like 
for brevity.


More information about the thelist mailing list