Democracy, The PHP Way - The Plan (
Page 2 of 9 )
The first order of business is to
decide the features to be supported by this application. Obviously, there needs
to be a mechanism by which the user can view a question, and then select from a
list of possible answers. Once the "vote" has been captured, it's traditional to
offer the voter an opportunity to look at the results generated thus
far.
For purposes of this tutorial, I'll assume that each poll consists
of a single question, with three possible responses.
So far as the
results are concerned, it's quite easy to provide a tabular report of the votes
for each possible option. However, I plan to make the application look more
professional by providing a graphical report, in the form of a bar graph. This
might seem difficult to do, since the graph would need to be dynamically
generated depending on the votes, but PHP's image generation functions make it a
snap.
A quick review of the various Web portals suggests that most of
them also allow visitors to view the results of previous polls (this is
particularly useful if the poll question changes on a daily basis). This is not
too difficult to do - so let's add that to the feature list as well.
With
this skeleton in mind, the next step is to design a database that supports these
requirements.
This article copyright Melonfire
2001. All rights reserved.