Reply to Re: Can't figure out how to create hierarchical multi array in such situation

Your name:

Reply:


Posted by alexandis on 11/27/07 08:24

Thanks! One more question. Now i need to create selectlists filled
with data of every corresponding hierarchy class:
I've made recursive function

function nestedSelectionList($level, $data, $result, $id = "") {
$result[$level] = "<select id=\"nest_".$level."\" name=\"nest_".
$level."\">";
foreach ($data as $key => $value) {
$id_key = ($id == "" ? "" : $id.":").$key;
$result[$level] .= "<option value=\"".$id_key."\">".$key."</
option>";
if (is_array($value)) {
nestedSelectionList($level + 1, $value, &$result, $id_key);
}
}
$result[$level] .= "</select>";
}

And first selectlist is created ok, but i can see that next ones -
not, because pointer is moved to the last element, so list 2, 3, ...
contain only 1 element :( I tried to play with reset(), but it didn't
help... How to manage this, please?

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация