Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loading multiple PHP variables into Flash array

Status
Not open for further replies.

TommyIndigo

Programmer
Sep 14, 2000
67
US
I am using LoadVars to retrieve a result from PHP. The echoed result is something like:

&name1=bill&city1=chicago&name2=alice&city2=austin&

I am trying to load the result such as above into a Flash array, such that the final array values would be:
name[0]=bill
city[0]=chicago
name[1]=alice
city[1]=austin

Assuming the LoadVars object is named "container", I can certainly load an explict variable in using something like:
Code:
name[0]=container.name1

However, I would like to use a For loop to dynamically loop through the result and do something like:
Code:
name[i]=container.name[++i]

That idea doesn't work, but would there be a way that I can programatically select the result's variable based on a counter??
 
It may not be working because ++i actually permanently affects the value of i - try:

name=container.name[(i+1)];
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top