ZISP Demon Logo
 

[ Online Survey - Reference ]

The Online Survey lets visitors to your page vote in a survey of your choice.

Dynamic Tools files created within your website:

  • /_zisp_/vote.txt - text file containing survey voting statistics

Template files used by this Dynamic Tool

  • vote.html - displays the different choices to vote for.
  • v_ack.html - acknowledges and thanks visitor for voting.
  • v_view.html - displays current voting statistics.

Options available:

  • ID - have multiple independent online surveys.

Online Survey Setup

Use the following HTML hyperlink to link to your online survey:

<A HREF="/zisp/vote">Click here</A>

Use this HTML hyperlink to display the results of your survey:

<A HREF="/zisp/vote_show">Click here</A>


Editing your Online Survey results

The results from your online survey are stored in the "vote.txt" file hidden in the "_zisp_" folder in your website.

You change these results by downloading this file, editing it and then uploading it again.

You can download the file from your web browser, by accessing the following page and saving the results as "vote.txt" on your home computer:

http://www.mysite.com/_zisp_/vote.txt

You will need to replace "www.mysite.com" with the name of your own web site.

The file will contain the current results of your survey. Each line contains a key (the category value in the survey), a colon (":"), a space and then the number of votes for that category:

Blue: 1
Green: 1
Red: 3

You can edit this file (for example, using Notepad). Save it and upload it back to your web site, replacing the existing file.

You can also reset the survey to zero by deleting the file from your website. Dynamic Tools will create a fresh "votes.txt" file the next time your web page is accessed.


Customising your Online Survey using Templates

The Online Survey Dynamic Tool uses three template files to generate the pages your visitors see.

If you haven't already done so, you might like to a quick look at the Templates Reference page in this documentation.

Template files should be stored on your website, in a folder called "easyzisp".

The vote.html template

When a visitor clicks on your "/zisp/vote" link they will see a page generated from the "vote.html" template:

<h1>Vote in my survey</h1>

You can vote in my survey using this form:

<blockquote>
<form method=POST action="vote">
  <b>My favorite color is: </b>
  <ul>
  <li><input type=radio name=CATEGORY value=Red>
      <font color=red><b>Red</b></font>
  <li><input type=radio name=CATEGORY value=Green>
      <font color=green><b>Green</b></font>
  <li><input type=radio name=CATEGORY value=Blue>
      <font color=blue><b>Blue</b></font>
  </ul>
  <input type=submit value="Cast my vote">
</form>
</blockquote>
Thank you!
<p>
<hr noshade size=1>

<form method=POST action="vote_show">
<input type=submit value="View current voting statistics">
</form>

<a href="/">Click here</a> to return to my home page.

This template must contain a form with the following parameters:

<form method=POST action="vote">

This form must contain a form element named "CATEGORY" and a submit button. The "CATEGORY" element can be either a radio box (as in the example above) or a select list:

<form method=POST action="vote">
  <b>My favorite color is: </b>
  <select name=CATEGORY>
  <option value=Red>Red</option>
  <option value=Green>Green</option>
  <option value=Blue>Blue</option>
  </select>
  <br>
  <input type=submit value="Cast my vote">
</form>

The value of the "CATEGORY" element is used to identify what the user has voted for, and is recorded in the "votes.txt" file.

You can change the subject of the survey from "colors" to anything else. You just need to change the values for each option of the "CATEGORY" form element.

The v_ack.html template

When the visitor to your site submits a vote, the Online Survey Dynamic Tool generates an acknowledgement page from the "v_ack.html" template file.

<h1>Thank you</h1>

Thank you for your vote. I have recorded it in my survey.

<form method=POST action="vote_show">
<input type=submit value="View current voting statistics">
</form>
<p>
<a href="/">Click here</a> to return to my home page.

If you don't want to show an acknowledgement page and would rather go straight to the results page, you can change your v_ack.html template file to simply redirect to the vote_show script. Replace the contents of v_ack.html with the following code:

<HTML>
<HEAD>
</HEAD>
<BODY>
<meta http-equiv="Refresh" content="0; URL=/zisp/vote_show">
</BODY>
</HTML>

The v_view.html template

When a visitor clicks on your "/zisp/vote_show" link they will see a page generated from the "v_view.html" template:

<h1>My Survey</h1>

The current status of my survey is:
<blockquote>
<table>
<!--SURVEY ENTRIES-->
</table>
</blockquote>

<form method=GET action="vote">
<input type=submit value="Vote in my survey">
</form>
<p>
<a href="/">Click here</a> to return to my home page.

This template generates a page with the results of your survey. It has one special tag: "<!--SURVEY ENTRIES-->". This tag must enclosed inside an HTML table ("<TABLE>" and "</TABLE>").

When the webserver displays this template, it replaces the special "<!--SURVEY ENTRIES-->" tag with the results of your survey.


Using multiple Online Surveys

You might want to have several online surveys on different topics. You can do this by giving each separate survey its own "ID".

<A HREF="/zisp/vote?ID=NN">Click here</A>

... and

<A HREF="/zisp/vote_show?ID=NN">Click here</A>

... where "NN" is a number between 0 and 99.

For example, the survey with ID "45" will store its results in the file "vote45.txt" in your "_zisp_" directory. The standard vote.txt file is created automatically, however any extra vote files must be created manually by you before they can be used. Your ISP should provide details on how to do this. Zisp will try to use the templates named "vote45.html", "v_ack45.html" and "v_view45.html" in your "easyzisp" directory, if they exist.

For security reasons, you must create the voteNN.txt files yourself. This can be done using a simple text editor like Notepad and uploaded to your website. Your ISP should provide details on how to do this.


Additional security

It is a good idea to ensure that only valid votes are submitted to your survey. In order to help enforce this, you can place a simple file in your "_zisp_" directory. This file must be called "categories.txt" and should contain a list of the valid vote options you want to allow in your survey. Each category should be listed on a separate line as shown below:

red
green
blue

Bear in mind that this is entirely optional, and should you not require any vote checking simply remove this file from the "_zisp_" directory. You can add it again at any point.

If you are using multiple surveys, you can apply the "ID" system (described in the previous section) to the categories file. In these circumstances you would create a file with the name "categoriesNN.txt" where "NN" is the ID number (between 0 and 99) of your survey.