//if they are not voting, this displays the results if they have already votedThe final part of the script runs if they are not in voting mode. It checks to see if they have a cookie in their browser. If they do, then it knows they have already voted and displays the poll results for them. If there is no cookie, it then checks to make sure they aren't in voted mode. If they are, then nothing happen, but if they are not it displays the form that lets them vote.
if(isset($_COOKIE[$cookie]))
{
pie ();
}
// or if they have not voted yet, they get the voting box
else
{
if(!$mode=='voted')
{
?>
<form action = "<?php echo $_SERVER[PHP_SELF]; ?>" method = "GET">
<select name="vote"> <option value="1">Option 1</option>
<option value="2">Option 2</option> <option value="3">Option 3</option>
</select>
<input type=hidden name=mode value=voted>
<input type=submit>
</form>
<?
}
}
?>
It is a good idea to include this poll on your page using the include function. Then you can place the poll anywhere you want within the page, simply using one line.
INCLUDE 'http://www.yoursite.com/path/to/poll.php' ;


