Flash/PHP

Using PHP as middleware, the following is displayed in the browser:

&thePrices=partCD+Player&thePrices=price320&thePrices=partShocks&thePrices=price450&thePrices=partCar+Cover&thePrices=price500

This appears in the output window in FLASH:

price500

What changes need to be made to the PHP/AS.


<?xml version="1.0" encoding="ISO-8859-1"?>
<priceList>
	<part id="001-A">CD Player</part>
	<price>320</price>
	<part id="002-A">Shocks</part>
	<price>450</price>
	<part id="003-A">Car Cover</part>
	<price>500</price>
</priceList>


<?php
//Create path to document
$doc="./priceList.xml";
global $thePrices;
//load document.
$xml=simplexml_load_file($doc);
//echo $xml->asXML() . '<br />';
//loopthrough names and prices.
//echo $xml->getName() . '<br />';
foreach ($xml->children() as $child){
	echo $child->getName(). ": " . $child . '<br />';
	$thePrices.= "&thePrices=".	(urlencode($child->getName() . $child));
	}

echo $thePrices;
/*
$thePrices .= (urlencode($child->getName() . $child));
'thePrices'=$thePrices;
*/


?>


//Create the LoadVars instance to retrieve the prices from the PHP script.
var getPrices:LoadVars=new LoadVars();
//load prices from PHP.
getPrices.load("http://localhost/~username/folderpath/autoPrices/pricesFlash.php?ck=" + new Date().getTime());
//
getPrices.onLoad=function(){
	trace(this.thePrices);
	
	
}