Home arrow PHP arrow Page 2 - Democracy, The PHP Way

The Plan - PHP

One of the simplest and most popular add-ons to a Web site is anonline poll, allowing visitors to vote on hot-button issues. In thisarticle, find out how PHP can be used to build a powerful, good-lookingonline poll for your Web site, and also learn a little bit about its imageand cookie manipulation functions.

  1. Democracy, The PHP Way
  2. The Plan
  3. Design View
  4. Start Me Up
  5. Vote Now, Or Forever Hold Your Peace
  6. The Number Game
  7. Down Memory Lane
  8. Cookie-Cutter Code
  9. Adding More...
By: Vikram Vaswani, (c) Melonfire
Rating: starstarstarstarstar / 24
April 16, 2001

print this article


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.

>>> More PHP Articles          >>> More By Vikram Vaswani, (c) Melonfire

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates


Dev Shed Tutorial Topics: