$doc = new DOMDocument(); $doc->load("xml/results.xml"); $root = $doc->getElementsByTagName("results")->item(0); $question = $root->getAttribute("question"); $pollitems = $doc->getElementsByTagName("pollitem"); foreach( $pollitems as $pollitem ) { //Create a radio button... } function setVote(voteName) { document.getElementById("votefor").value = voteName; } function confirmSubmit() { if (document.getElementById("votefor").value == "") { var agree=confirm("Please select an entry before voting."); return false; } } // Get max vote count $doc = new DOMDocument(); $doc->load("xml/results.xml"); $maxvotes = 0; $pollitems = $doc->getElementsByTagName("pollitem"); foreach( $pollitems as $pollitem ) { $votes = $pollitem->getElementsByTagName("votes"); $vote = $votes->item(0)->nodeValue; $maxvotes = $maxvotes + $vote; }

0 comments: