So I made this voting thing where you click 6 of 12 boxes and that would send the info to a .php and to a database, but I’m having trouble figuring out how to set up the .php… Here’s my actionscript:
var myLv:LoadVars = new LoadVars();
var resultArray:Array = ["empty"];
var totalPressed:Number = 0;
stop();
for (i=1;i<13;i++) {
this["box"+i].id = i;
this["box"+i].onRelease = function() {
judgeAmount(this,this.id);
};
resultArray.push(0);
};
function judgeAmount(box:MovieClip,idNo:Number):Void {
if (box._currentframe == 2) {
totalPressed--;
resultArray[idNo] = 0;
this["box"+idNo].voting = 0;
box.gotoAndStop(1);
}
else {
if (totalPressed < 6) {
box.gotoAndStop(2);
resultArray[idNo] = 1;
this["box"+idNo].voting = 1;
totalPressed++;
}
};
if (totalPressed == 6)
{
submit._alpha = 100;
submit.enabled = true;
}
else
{
submit._alpha = 0
submit.enabled = false;
}
}
submit.onRelease = function():Void
{
sendVars();
_root.gotoAndStop(2);
}
myLv.onLoad = function():Void
{
trace("data sent");
}
function sendVars():Void
{
var len:Number = resultArray.length;
for (i=1;i<len;i++)
{
myLv["var"+i]=resultArray*;
}
myLv.sendAndLoad("myphp.php",myLv,"POST");
}
Now I’m just wondering how should I set up the .php to receive the information? Do I put all the instance names of the movieclips (box 1, box 2, box 3, etc…) or do I some how set it up to receive the array… I’m really confused on the subject. :puzzle: