Passing xml tree to php

Basicaly I’m passing xml tree to php and having php insert it into a db, no luck yet, I’m not sure where i’m going wrong with this.
Thanks for any help with this.

Here’s the code i’m using.

//AS3
var team_xml:XML = new XML(

<league>
    <teams>
        <team>Team 1</team>
        <team>Team 1</team>
    </teams>
</league>

);

var request:URLRequest = new URLRequest(“testing.php”);
request.method = URLRequestMethod.POST;

var variables:URLVariables = new URLVariables();
variables.xml = team_xml;

request.data = variables;
var loader:URLLoader = new URLLoader();

loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, teamReturn);
loader.load(request);

//PHP
<?php

$sx = $_POST[‘xml’];

//DB Connection -------------------------------------------------------------------------------------------------
$dbhost = “xxx”;
$dbuser = “xxx”;
$dbpass = “xxx”;
$dbname = “xxx”;

$connection = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname) or die(“Could not connect to host.”);
mysqli_select_db($connection, $dbname) or die (“Error”);

foreach ($sx->team as $team){

$teamname = $team-&gt;teamname;
mysqli_query($connection, "INSERT INTO teams (teamname) VALUES ('$teamname')");    

}

echo “xml=Done”;

?>