'; $query2 = mysql_query("SELECT votes, choice FROM polloptions WHERE link='$identifier'"); while ($output2 = mysql_fetch_assoc($query2)) echo $output2['choice'].' ('.round($output2['votes']/$output['totalvotes']*100, 2).'%)
'; echo 'Vote - Total Votes: '.$output['totalvotes']; } else { if($_POST['submit']) { $result = mysql_fetch_assoc(mysql_query("SELECT totalvotes FROM pollquestions WHERE id = '$identifier'")); $totalvotes = $result['totalvotes'] + 1; $i = $_POST['choices']; $result2 = mysql_fetch_assoc(mysql_query("SELECT votes FROM polloptions WHERE id = '$i' AND link = '$identifier'")); $votes = $result2['votes'] + 1; mysql_query("UPDATE pollquestions SET totalvotes = '$totalvotes' WHERE id = '$identifier'"); mysql_query("UPDATE polloptions SET votes = '$votes' WHERE id = '$i'"); echo 'Thank you for voting. View Poll'; } else { $output = mysql_fetch_assoc(mysql_query("SELECT question FROM pollquestions WHERE id='$identifier'")); echo '
'; echo $output['question']; $query2 = mysql_query("SELECT id, choice FROM polloptions WHERE link = '$identifier'"); $output2 = mysql_fetch_assoc($query2); echo '
'.$output2['choice']; while ($output2 = mysql_fetch_assoc($query2)) echo '
'.$output2['choice']; echo ''; echo '
'; } } ?>