Step 3/4 - Confirm your vote\n";
$result .= "
".$election["question"]."
\n";
if (($choices_nb == 1 && $vote >= 0) ||
($choices_nb > 1 && count ($votes_array) >= 1)) {
$result .= "You choose to vote for:
\n";
$result .= "\n";
if ($choices_nb == 1) {
$choice = null;
foreach ($choices as $opt) {
if ($opt["id"] == $vote) {
$choice = $opt;
break;
}
}
if ($choice != null)
$result .= "
".$choice["choice"]."
\n";
else {
$result .= "
Unknown vote: ".$vote."
\n";
$error .= "There was an unkown vote: ".$vote."
\n";
}
} else {
$result .= "
\n";
foreach ($votes_array as $vote) {
$found = FALSE;
foreach ($choices as $choice) {
if ($choice["id"] == $vote) {
$result .= "- ".$choice["choice"]."
\n";
$found = TRUE;
break;
}
}
if (!$found) {
$result .= "- Unknown vote: ".$vote."
\n";
$error .= "There was an unkown vote: ".$vote."
\n";
}
}
$result .= "
\n";
}
$result .= "
\n";
} else {
$result .= "\n";
$result .= "
You choose to vote for none of the possible answers.
\n";
$result .= "
\n";
}
$result .= "To confirm this vote, please continue to the next step.
\n";
return $result;
}
?>