Multiple comboboxes from php

Hi, I’ve been having a problem using comboboxes to read from a php script. I want to use around 6 different comboboxes to control a number of different movie clips. I have everything working fine reading from 1 combobox using the following code:

php script:


<?php
$NameArr = array("Headphones", "Sunglasses",  "Hat");
$DataArr = array("headphones", "sunglasses", "hat");
for($i=0;$i<count($NameArr);$i++) {
$data[] = $NameArr[$i].":".$DataArr[$i];
}

print implode("
", $data);
?>

Flash:
[AS]
//Create a new instance of the LoadVars object
myVars = new LoadVars();

//Load the text file
myVars.load(“loadCombo.php”);

//Run this when the data has loaded
myVars.onData = function(raw) {
//Split the loaded text into an array by newline
tmp = raw.split("
“);
//Loop through the array
for(var i=0;i<tmp.length;i++) {
//make a new array from each element of the first array splitting on the | symbol
tmp2 = tmp*.split(”:");
//Add an item to the comboBox for this element of the text file
myCombo.addItem(tmp2[0], tmp2[1]);
}
}

//Selection - Select MC
mycombo.setChangeHandler(“onChange”);
onChange=function()
{
_root.man[selected]._visible = false;
selected = mycombo.getValue();
_root.man[selected]._visible = true;
}

function traceCombo(com) {
trace (“Selected Data: " + com.getSelectedItem().data);
trace (“Selected Label: " + com.getSelectedItem().label);
trace (”--------------------------------------”);
}

[/AS]

Now I’m having trouble figuring out what would be the best way to go about reading to multiple comboboxes without creating a number of different functions? Would I be able to redefine the current function to load text into multiple comboboxes from my php script? I’m not sure how to sort out my arrays either.

Ok, I’ve spent all night trying to figure this out but have not been able to solve it yet. I’ve read through all kinds of tutorials and forums, but I don’t see a solution. Does anyone have any ideas? How do I get $data[] and $data2[] into separate comboboxes?

Here is what I was trying:

PHP script:


<?php
$NameArr = array("Headphones", "Sunglasses", "Hat");
$DataArr = array("headphones", "sunglasses", "hat");
$NameArr2 = array("Short", "Spiked", "Afro");
$DataArr2 = array("hairShort", "spiked", "afro");
for($i=0;$i<count($NameArr);$i++) {
$data[] = $NameArr[$i].":".$DataArr[$i];
}
for($i=0;$i<count($NameArr2);$i++) {
$data2[] = $NameArr2[$i].":".$DataArr2[$i];
}

print implode("
 a", $data);

print implode("
 b", $data2);
?>

Flash:

[AS]
//Run this when the data has loaded
myVars.onData = function(raw) {
//Split the loaded text into an array by newline
tmp = raw[“a” + i].split("
");

    //Loop through the array
    for(var i=0;i&lt;tmp.length;i++) {
            //make a new array from each element of the first array splitting on the | symbol
            tmp2 = tmp*.split(":");
			
            //Add an item to the comboBox for this element of the text file
            myCombo.addItem(tmp2[0], tmp2[1]);
			
    }

[/AS]