web design and hosting
features and pricing my account customer support about ICG Link, Inc. contact ICG Link, Inc.

Poll Script
Our poll script is a simple, effective way to get an opinion from your site visitors. There are four components necesary to make the script work: A question page that calls the script and asks the question, a data file that stores the relevant information about the choices, a results template that is used to display the results and a storage database for the results. The first three are created by you and the storage database is created by the script.

Question Page

You must call the script as follows:

<FORM METHOD=POST ACTION="/cgi-bin/poll.pl/polldata?somename.html">
  • where polldata (votetest in this example) is a subdirectory in the data directory;
  • polldata.data (votetest.data in this example) is the name of the tab delimited text file in the data directory that stores the choices;
  • and somename.html (vote.html in this example) is the results template file in the polldata subdirectory.
Radio Buttons: Use something like <INPUT TYPE=RADIO NAME="vote" VALUE="Elmo"> Tickle-Me Elmo<BR> for radio buttons, where NAME must be the same for all entries and VALUE is one of the items in the first column of the data file (ID in this example).

Checkboxes: Use something like <INPUT TYPE=CHECKBOX NAME="telnet"> Telnet<BR> for checkboxes, where NAME is one of the items in the first column of the data file (ID in this example) and VALUE is not required.

Sorting: You can leave the results in the order they appear in the data file or you can sort them in either ascending or descending order by including a hidden field with NAME=ascend or NAME=descend, for example: <INPUT TYPE=HIDDEN NAME="sort" VALUE="descend">

Formatting: You can specify the number of pixels to use for 100% of the votes by including a hidden field, for example: <INPUT TYPE=HIDDEN NAME="fullsize" VALUE="400">

Preventing Ballot Box Stuffing: You can prevent visitors from stuffing the ballot box by speficying a hidden field with NAME=f_lock and VALUE equal to the number of minutes before that visitor can vote again, for example: <INPUT TYPE=HIDDEN NAME="f_lock" VALUE="120">

Submit: Two submit buttons are available:
  • If NAME=submit, then a vote is counted, for example: <INPUT TYPE=SUBMIT NAME="submit" VALUE="Vote!">
  • If any other name is used, the results are viewed without voting, for example: <INPUT TYPE=SUBMIT NAME="view" VALUE="View Results!">
Data File

A tab delimited text file, votetest.data in this example, must be located in the data folder. Field names on the first line can be anything you want them to be. They might be used by the search script, for example, to generate a question page that is controlled from a back office that you might make using the form, search and replace scripts.

The first four fields in your data file must be: unique choice name, choice description, text color and a graphic that makes the bar. For example:
ID     Description    Color    Graphic
Furby  Talking Furby  aaaaaa   orange.gif
Smurf  Papa Smurf     3333cc   green.gif
Elmo   Tickle-Me Elmo cc3333   yellow.gif
In this example, the bar images would be in your root www folder. If, for example, you wanted the images to be in a folder called www/images, you would call the image in the data file as images/orange.gif. If you would like to use the standard images from this example, you can find them in http://www.icglink.net/std/images/voteimages/colorxx.gif where xx has a value from 01 - 10 defining ten different colored images we have placed there for your use.

Results Template

In the results template, everything between the VOTELOOP tags is repeated for as many times as you have items. Any item defined as f_item will come from the database.

<! count> is the number of votes for an item
<! percent> is the count/total votes
<! size> is percent*fullsize
<! notsize> is fullsize-size (or 400-size in this case) so Netscape can size the table properly.
<! total> is the total number of votes and can be outside VOTELOOP.
For example:

<TD><FONT COLOR="<! f_Color>"><! f_Description> - </FONT></TD>
<TD><! count> votes</TD>
<TR><TD WIDTH="<! size>" HEIGHT=9><IMG SRC="/<! f_Graphic>" WIDTH="<! size>" HEIGHT=9></TD>
<TD WIDTH="<! notsize>"><FONT SIZE=-2><! percent>%</FONT></TD></TR>
Storage Database

A tab delimited text file is created by the script to store the results of your poll. It can be found in the www/data/polldata folder and can be deleted to reset the results to zero or edited to seed the file with starting values.


Here are two examples of the poll script in action. In the first, we use radio buttons, descending results display and a 400 pixel full size. In the second one, we use checkboxes and no sorting, but we do use all the possible colors we provide for you and we limit the ballet box stuffing to no more than one vote per minute.
ICG Link, Inc. 7003 Chadwick Drive, Suite 111, Brentwood, TN 37027