pie.Set('chart.gutter.top', 50); pie.Set('chart.colors', ['grey', 'blue']); pie.Set('chart.colors.sequential', true); pie.Set('chart.title', 'Voting Results'); pie.Set('chart.labels', [ <?php if (tallyVotesFor("")) { echo "'Undecided',"; } for ($i = 1; $i <= GETnumberOfChoices(); $i++) { if (tallyVotesFor($i)) { echo $i; } else { echo "' '"; } if ($i != GETnumberOfChoices()) { echo ","; } } ?> ]); pie.Draw(); } </script> <?php echo "</br>" . tallyVotesFor(""); if (tallyVotesFor("") == 1) { echo " Voter is still undecided."; } else { echo " Voters are still undecided."; }
function randomVotes($howMany) { global $con; $max = GETnumberOfChoices(); for ($x = 0; $x < $howMany; $x++) { $random = rand(1, $max); //submit ballot to VotingBox table if (!mysql_query("INSERT INTO VotingBox (voter, ballot) VALUES ('NULL','{$random}')", $con)) { echo "ERROR " . mysql_error(); } } }
</span> <ul class="pageitem"> <form name="reVote" action="index.php" method="post"> <li class="button"><input name="reVoteButton" type="submit" value="Change Vote" /></li> </form> </ul> <script language="javascript" type="text/javascript">setTimeout("location.reload();",10000);</script> <?php } else { ?> <span class="graytitle">Cast your vote:</span> <ul class="pageitem"> <form name="castVote" action="index.php" method="post"> <?php //output a number of choices equal to the number set by the admin for ($i = 1; $i <= GETnumberOfChoices(); $i++) { ?> <li class="radiobutton"><span class="name"><?php echo GETlabelFor($i); ?> </span><input name="selection" type="radio" value="<?php echo $i; ?> " /></li> <?php } ?> <li class="button"><input name="castVoteButton" type="submit" value="Cast Vote" /></li> </form> </ul>