Poll

One vote each, results live. The database counts the votes, and a signed cookie remembers that you voted.

What should we order for the team lunch?

Vote once, count live
set my_vote to remembered "poll_vote"
if form "sent" is "yes" and my_vote is empty
  set pick to form "choice"
  if choices contains pick
    tell database "insert into votes (choice, voted) values (?, ?)" with pick, now
    remember "poll_vote" as pick
    go to "/poll"
  end
end

for each choice in choices
  set votes to n of first of ask database "select count(*) as n from votes where choice = ?" with choice
  show "<div style='width: [votes * 100 / total]%'>[choice]</div>"
end

choices contains pick means a vote for something that is not on the list is ignored, whatever a visitor sends.