Survey template

PHP, Tutorials

This article explains the inner workings of Survey template.

Before we start I encourage you to check Survey template live demo. Register, then login and add a new Survey. Add questions, answers and answer options where necessary. Once done with setup activate the survey. Now you can take survey, view responses etc.

Purchase Survey template for $50

Application setup

Once you create a project using Survey template you can simply build your project and start using it. Security model is simple. There is one user by default (admin/admin) with full access to all data. There is also Guest account enabled with access to Response view Add page so guest users are able to take surveys without logging in.

There is also Registration page enabled. Users can register and create their own surveys. This option is mostly for demo purposes and you may want to turn it off.

Managing surveys

Once you are logged in create a new survey and add questions. Questions are grouped into groups. If you don’t need grouping simply add all question to default group (Group 1).

List of surveys is your start screen. You can add or delete surveys here, make them active or inactive, take surveys and view responses.

Each survey is created as inactive. You are free to modify survey structure, add or delete groups and questions. Once you done customizing your survey activate it. Survey activation creates a physical table in the database that will store all responses. You should only activate a survey when you are absolutely certain that your survey setup is finished and will not need changing.

Once a survey is activated you can no longer:

  • Add or delete groups
  • Add or delete questions
  • Add or delete answers

However you can still:

  • Edit your questions code/title/text and advanced options
  • Edit your group names or descriptions
  • Add, remove or edit answer options
  • Change survey name or description

Once data has been entered into this survey, if you want to add or remove groups or questions, you will need to deactivate this survey, which will move all data that has already been entered into a separate archived table.

Typical survey table name is sv_survey_{ID} where {ID} is survey id from sv_surveys table. When survey is deactivated table with responses renamed to something like sv_survey_old_1_20120307233417 (20120307233417 is the timestamp).

List of questions

This is you main single survey management screen. You can add/edit/delete questions, answers and answer options here, reorder groups and questions.

Question types

Survey template allows you to choose from the following question types




List (5 point choice)


List (10 point choice)


Dropdown box




Long text


Multiple choice




Multiple choice with comments




Simple text, no question




File upload



Visual appearance and additional files

To tweak visual appearance of your surveys modify the following files (can be found in project directory):
business\Survey\source\templates\survey.htm – ‘take a survey’ template
business\Survey\source\templates\survey_view.htm – ‘view single response’ template
business\Survey\source\templates\activate_survey.htm – message displayed in popup before survey activation
business\Survey\source\templates\deactivate_survey.htm – message displayed in popup before survey deactivation
business\Survey\source\survey.css – survey style sheet

HTML templates are similar to standard PHPRunner/ASPRunnerPro templates and use the same template language.

Here is the sample of survey.htm template:

{BEGIN group}
{BEGIN description_block} {$group_description} {END description_block} {$questions}
{END group}
{BEGIN prev_button} {END prev_button} {BEGIN finish_button} {END finish_button}

Update: Version 1.1, May 24, 2012

In this update:

  • Question preview in popup.
  • View all responses for selected question.
  • New Survey layout. When you create/edit survey choose between Silver-Blue and Grey templates
  • Add optional long question description.
  • Display additional question instructions under the question or on the right.

Grey template

Silver-blue template

Upgrade instructions

If you upgrading your projects from previous version of Survey template and want to keep existing surveys/responses here is what you need to do:

– If you use SQL Server database execute database\db_update.sql script against your existing database. If you use MySQL execute database\dbmysql_update.sql script. This will create new tables and fields. Then create a new project using Survey Template and point it to existing database. Choose ‘Use existing’ option to reuse existing tables.

– MS Access Survey projects cannot be upgraded automatically. You will need to create a new project and then copy data from old database file to new one manually.

1 thought on “Survey template

Leave a Reply

Your email address will not be published. Required fields are marked *