heres a way to hide the arrays in the javascript, and build a function... im not familiar with JS anymore, and im too tired to find out how to populate a select box via js, so thats upto you 🙂
// parent array //
$a=array("porsche"=>array("911","968","959"),
"parent2"=>array("child1","child2"));
// hide child arrays in js //
echo "\n<script language='javascript'>\n";
foreach($a as $key=>$value)
{
echo "$key=new Array(";
for($i=0;$i<count($value);$i++)
{
echo "\"" . $value[$i] . "\"";
if($i<(count($value)-1))
echo ",";
}
echo ");\n";
// print js functions here //
}
echo "</script>";
if you run that, then view the source -> it will have printed the arrays in js