Passing variables to Actionscript from Php

I know next to nothing of php, and was given a file that does a few calculations and such, then shows a Flash movie and is supposed to pass the variables to the flash movie. The problem is that when the variables load in flash they look like this “condition=1,1” instead of how they are supposed to look “condition=1.” I am not sure if the problem lies in the php script, the actionscript, or somewhere in between. All the tutorials that I can find inform me as to how to load variables from a php script into flash, but dont help much with the writing of the php script. Can someone look through the code and tell me if everything looks correct, and maybe help me understand what is actually going on. What is confusing me most is that I cannot find any code that outputs the variables.
Here is the Php (comments were written by my collaborator to help me understand it)


<?php 
$experimentname = "risk"; 
$numofconditions = 6;  
$conditionfilename = "$experimentname.txt"; 
   
//here is where we assign condition:
 
//read file
$condition_fh = file($conditionfilename); //this opens the condition file to figure out what the last conditon run was
$count = count($condition_fh)-1; //this counts the number of rows in the condition file
$lastcondition = $condition_fh[$count]; //this sets $lastcondition to the last number in the file...the last condition that was run
//print "$conditionfilename - $count - $lastcondition<br>";    
    
if($lastcondition ==$numofconditions){$newcondition = 1;} else {$newcondition = $lastcondition +1;} //this tells the program to go to the next condition. Also it sets it back to condition 1 if the last condition was equal to $numofconditions
   
$fh = fopen($conditionfilename, 'a'); //this opens the condition file to write the new conditon in
    
fwrite($fh,"$newcondition
"); //this writes the new condition to the file
 
fclose($fh); //closes the file
   
//Often times you want to know if someone started your experiment and then quit before submitting the data. 
//The next bit of code creates another file for you which simply keeps a log of IP address of anyone who started the program and when they did so
$date_start = date("Y-m-d"); //gets the current date
$time_start = date("H:i:s"); //gets the current time
$fh =fopen("startlog.csv", 'a'); //opens or creates a file called "startlog.csv" 
$ip = $_SERVER['REMOTE_ADDR']; ///gets the IP address of the user
fwrite($fh,  "$ip,$newcondition,$date_start,$time_start
"); //writes, the IP, condition, date, and time for every person that launches this program
fclose($fh); //closes the file
    
   
$filename="$experimentname.php"; //defines the name of the file being run as the name of the experiment
   
$flashfile="$experimentname.swf"; //defines the name of the flash program as the name of the experiment
   
$bgcolor = "#ffffff"; //sets the background color of the flash program
   
$width = "800"; //sets the width of the flash program
$height = "600"; //sets the height of the flash program
   
  
   
//The next two lines defines all the variables to pass to flash.
$valuestopass = "ip=$ip&experimenttitle=$name&experimentname=$experimentname&filename=$filename&condition=$condition&date_start=$date_start&time_start=$time_start";
$sendline = $flashfile . "?" . $valuestopass;
//The next line outputs the flash file to the user   
print "<table width='100%' height='100%' cellpadding='0' cellspacing='0' bgcolor='#ffffff'>
<tr>
<td><div align='center'>
<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab//version=8,0,0,0' width='800' height='600' id='preloader' align='middle'>
<param name='allowScriptAccess' value='sameDomain' />
<param name='movie' value='$sendline' />
<param name='quality' value='high' />
<param name='bgcolor' value='$bgcolor' />
<embed src='$sendline' quality='high' bgcolor='$bgcolor' width='$width' height='$height' name='$name' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />    
</object>
</div></td>
</tr>
</table>";
 ?>

here is my variable loader in AS3 if whoever reads this happens to know both


var condition
function dataLoader() {
 var request:URLRequest=new URLRequest("insert url here");
 request.method=URLRequestMethod.GET;
 var loader:URLLoader = new URLLoader();
 loader.dataFormat=URLLoaderDataFormat.VARIABLES;
 loader.addEventListener(Event.COMPLETE, completeHandler);
 loader.load(request);
 function completeHandler(evt:Event) {
  
  var ip=evt.target.data.ip;
  var experimentname=evt.target.data.experimentname;
  condition=evt.target.data.condition;
  var date_start=evt.target.data.date_start;
  var time_start=evt.target.data.time_start;
  
  storeData("ip",ip);
  storeData("experimentname",experimentname);
  storeData("condition",condition);
  storeData("date_start",date_start);
  storeData("time_start",time_start);
  trace('IP = ' + ip);
  trace('Experiment Name = ' + experimentname);
  trace("Condition = "+condition);
  trace("Start Date = "+date_start);
  trace("Start Time = "+time_start);
 }
}
dataLoader();