|
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?
Navigation:
[Reply to this message]
|