Jeg har brugt kaspers afstemnings artikel at kigge efter men kan ikke få den til at fungere
koderne
Den som der åbner 
<?php
include("dbconnect.php");
include("afstemning/pollfunctions.php");
$pid = 1; 
if(HaveVoted($pid) == true) {
	echo ShowResults($pid);
} else {
	echo ShowPoll($pid);
}
?>selve koden 
<?php
$dbtable_polls = "polls";
$dbtable_pollvotes = "pollvotes";
$cookieprefix = "xmas";
$redirectto = "http://privat.mr-xmas.dk/nyheder.php";
?>
<?php
if($_POST[do_vote] and $_POST[pid] and $_POST[vid]) {
	CastVote($_POST[pid], $_POST[vid]);
}
?>
<?php
function HaveVoted($pid) {
	global $cookieprefix;
	if(($_COOKIE[$cookieprefix."vote".$pid]) AND ($_COOKIE[$cookieprefix."poll".$pid] == $pid)) {
		return true;
	} else {
		return false;
	}
} 
?>
<?php
function CastVote($pid, $vote) {
	global $dbtable_pollvotes; global $cookieprefix; global $redirectto;
	if(HaveVoted($pid) != true) {	
		$addvote = mysql_query("insert into $dbtable_pollvotes (pollid, vote) values ('$pid','$vote')");
		setcookie($cookieprefix."vote".$pid, $vote, time()+999999999);
		setcookie($cookieprefix."poll".$pid, $pid, time()+999999999);	
		header("location: $redirectto");
	}
}
?>
<?php
function ShowPoll($pid) {
	global $dbtable_polls;
	$query = mysql_query("select * from $dbtable_polls where id='$pid'");
	if(mysql_num_rows($query) > 0)
	{
		$q = stripslashes(mysql_result($query, 0, "question"));
		$num = mysql_result($query, 0, "numofanswers");
		$kode .= '<div class=\\"pollquestion\\">$q</div>';
		$kode .= '<form action=\\"$_SERVER[PHP_SELF]\\" method=\\"post\\">';
		$i = 1;
		while($i != $num+1) {
			$a = stripslashes(mysql_result($query, 0, "answer".$i));
			$kode .= '<div class=\\"pollanswer\\"><input type=\\"radio\\" name=\\"vid\\" value=\\"$i\\" />$a</div>';
			$i++;
		}
		$kode .= '<input type=\\"hidden\\" name=\\"pid\\" value=\\"$pid\\" />';
		$kode .= '<br /><input type=\\"submit\\" name=\\"do_vote\\" value=\\" - Stem - \\" class=\\"button\\" />';
		$kode .= '</form>';
	}
return $kode;		
} 
?>
<?php
function ShowResults($pid) {
	global $dbtable_polls;	global $dbtable_pollvotes;
	$query = mysql_query("select * from $dbtable_polls where id='$pid'");
		$q = stripslashes(mysql_result($query, 0, "question"));
		$num = mysql_result($query, 0, "numofanswers");
		$kode .= "<div class=\\"pollquestion\\">$q</div>";
			$votesquery = mysql_query("select count(id) from $dbtable_pollvotes where pollid='$pid'");
			$totalvotes = mysql_result($votesquery, 0, 0);
		$i = 1;
		$kode .= '<table style=\\"width: 95%;\\" class=\\"text\\">';
		while($i != $num+1) {
			$a = stripslashes(mysql_result($query, 0, "answer".$i));
			$resultquery = mysql_query("select count(id) from $dbtable_pollvotes
 where pollid='$pid' and vote='$i'");
				$votes = mysql_result($resultquery, 0, 0);
				if($votes > 0) {
					$average = round(100 * $votes / $totalvotes, 2); 
				} else {
					$average = "0";
				}
			$kode .= '<tr>';
			$kode .= '<td colspan=\\"2\\"><div class=\\"pollanswer\\">$a:</div></td>';	
			$kode .= '</tr><tr>';		
			$kode .= '<td style=\\"width: 75%;\\"><span class=\\"pollbar\\" style=\\"width: $average%;\\"></td>';
			$kode .= '<td></span>  <span style=\\"text-align: right; font-weight: bold;\\">$average%</span></td>';
			$kode .= '</tr>';			
			$i++;
		}
		$kode .= '</table>';
		$kode .= '<br /><div style=\\"text-align: center;\\">Stemmer i alt:<br /><b>$totalvotes</b></div>';
return $kode;
}
?>