Building a better poll
We have looked at three levels of poll difficulty, but there is still a lot more to do if you want to. We're not going to cover it here, because this book is not just about poll writing, but why not try extending your poll with these ideas:
Figure out which parts of the tables should be indexed for maximum performance. Remember the rule about indices: have too many and you will end up slower than without any.
Add a click through link to see the results without voting. This is fairly straightforward, as the actual voting process requires a vote to be set - simply exclude this.
Write a breakdown of the results using a demographic, or perhaps using the DateVoted number. There is lots to try out here!
Write code to let people add their own options. You probably will not use this in a live site, but it is good to practice.
Make the results page draw a graph. The easiest way to do this is using a horizontal bar chart, using a simple picture for each 1% of the total an option holds, e.g. a vote with 25% would have 25 of these pictures lined up side by side)
There is lots you can do with opinion polls, and we've only scratched the surface here - they are very easy to write, and consequently very easy to toy around with if you have new ideas.
Next chapter: Creating a guestbook >>
Previous chapter: Making the final poll
Home: Table of Contents