AMurray:
Sorry, I disabled that form.
You can check an example in http://campeche.com/encuestas/index.php?id_1=8&id_2=1&id_3=0&id_4=0
girljinbink:
I made a machform directory where I use only 1 field multiple choice forms.
The machform db structure includes a table called 'ap_element_options' where field 'form_id' is the number of the form you want to show results from. All rows with the same 'form_id' will have different 'position' (or 'option_id' which have the same values). Each 'position' is a choice for the form.
By querying ($id is the form number passed in the url so the same script takes care of all polls):
$result = mysql_query("SELECT position, option FROM ap_element_options WHERE form_id = '$id'");
you will get all rows with the same form_id thus getting all choices (choice number and name) of your poll:
while ($row = mysql_fetch_array($result))
{
$choice[$total]['position'] = $row['position']; //choice number
$choice[$total]['option'] = $row['option']; //text describing choice
$choice[$total]['votes'] = 0; //will store total votes per choice
$total++;
}
At this point, you have a multidimentional array holding poll values.
Then you count the number of times (rows) each choice has been selected (I used a for loop based on $total). Those are saved in table 'ap_form_x' where 'x' is your 'form_id' and field element_1 has the same value than 'option':
$result = mysql_query("SELECT element_1 , COUNT( * ) as votes FROM ".$apform." WHERE element_1 ='$i' GROUP BY element_1");
$row = mysql_fetch_array($result);
$choice[$i]['votos'] = (int)$row['votes'];
$totalVotes = $totalVotes + $choice[$i]['votes'];
then I sort the array based on total votes to show them from max to min votes.
From that point you display the results of your poll.
I hope that helps.