Passing variables from PhP to Actionscript

I have a PhP script that passes several variables to flash. I am fairly new to AS and know nothing of PhP. The PhP script was originally written for an AS2 file and required no AS code to import the variables. The way i am doing it in AS3 it seems to be loading the variables but instead of condition=1 it loads condition=1,1

here is the php (the comments were written by a collaborator who sent me the file, he only know AS2 and could not help me)

$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
"); //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'>
<td><div align='center'>
<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase=',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='' />    

here is how i have been loading the variable in AS3

var condition
function dataLoader() {
 var request:URLRequest=new URLRequest("insert url here");
 var loader:URLLoader = new URLLoader();
 loader.addEventListener(Event.COMPLETE, completeHandler);
 function completeHandler(evt:Event) {
  trace('IP = ' + ip);
  trace('Experiment Name = ' + experimentname);
  trace("Condition = "+condition);
  trace("Start Date = "+date_start);
  trace("Start Time = "+time_start);