I'm working on a Flash AS3.0 project. I have Flash posting variables out to a PHP script and the handling the return, the problem is with the PHP script.
I'm trying to open an XML file, locate a node with XPATH, get its "vote" attribute value, add one to the value and reset it to the new value.
My script:
$name = $_POST[contestantName];
$doc = new DOMDocument();
$doc->load("contestants.xml");
// Locate contestant by name
$xpath = new DOMXpath($doc);
$query = "//*[.='$name']";
$nameEtal = $xpath->($query);
// Get current # of votes, add 1, set attribute to new value
$votes = $nameEtal->getAttribute('votes');
$votesPlus = ($votes + 1);
$nameEtal->setAttribute("votes", $votesPlus);
// Save
$doc->save("contestants.xml")
// Talk Back
echo 'answer=ok';
?>
THANKS!