Replicate PHP code for each section in an INI file

Anaphylaxis

New Member
\[code\]<? $config = parse_ini_file('/list.ini', true); ?><?echo'<select id="LBox" name="listbox" size="20" style="display:none;">'; foreach($config[MPR] as $id=>$label){ switch ($id) { case ($id==select): echo'<option value="http://stackoverflow.com/questions/13737224/0" selected="selected"></option>'; break; case ($id>0 && $id<=10): echo'<optgroup label="'.$label.'">'; break; case ($id>10 && $id<=20): echo'</optgroup>'; break; default: echo'<option value="'.$id.'">'.$label.'</option>'; } }echo'</select>';?>\[/code\]Above is code that builds a hidden list box and fills its options from an INI file. I would Like to replicate this for each section in my ini, but I am unsure of the best way to do this, other than copy and paste this 8 times with a new $config[x] value. Is there a way to replicate this for each section?
 
Back
Top