About flexSURVEY


2012-05-10 flexSURVEY 2.0 released! See the Changelog.

flexSURVEY is a small-in-size but powerful tool for creating flexible PHP-driven online surveys and questionnaires.

It is free software (GPL).

With flexSURVEY, surveys are created by writing PHP source code using flexSURVEY's functions and lightweight markup language.

Here is a simple example:

echo fsAdd("<p>Your name: {name,text}</p>
            <p>What season do you prefer?<br />
            {season,radio} Summer<br />
            {season,radio} Winter</p>"

This would add a text input field and two radio buttons to the survey. flexSURVEY will not just output the HTML of the form elements, but automatically create columns "name" and "season" in your MySQL database, save the values when submitted, do security checks, and more.

You can combine flexSURVEY's functions with your own PHP code e.g. to dynamically create items, give feedback to the user, send login parameters per email or whatever. Also, flexSURVEY produces (almost) no (X)HTML beyond the form elements, thus no restrictions on the page layout. If you wish you can use the demo survey as a template from which to start.

Because surveys are just PHP code you can copy and change things easily. When creating multiple similar surveys you do not have to start from the beginning for every survey. You do not have to mouse-click through a graphical user interface. Just text. If you like that, you may want to use flexSURVEY even for non-dynamic questionnaires.


flexSURVEY has only few explicit features - its power stems from its flexible design.

Have a look at the demo survey - it gives a taste of what's possible.

Features include among others:

  • Text (code) instead of a graphical user interface. (Yes, let's call this a feature.)
  • Integrates with your own PHP code. (E. g. for conditional content, sending emails, using LDAP for login, ...)
  • All standard (X)HTML form elements except file upload are supported, namely text fields, textareas, password fields, hidden fields, dropdown menus, radio buttons, and checkboxes. (You can create additional item types - e. g. sliders, sorting - by including your own JavaScript or an external library.)
  • Lightweight markup language for...
    • easy inclusion of form elements.
    • easy inclusion of tables, e. g. for lists of checkboxes or radio buttons. Automatic label tag inclusion is supported.
    • easy inclusion of label tags, e. g. when layout is too complex for automatic labels.
  • MySQL support:
    • Tables and columns are created automatically (even if you add variables while the survey is running).
    • Different tables can be used for different variables.
    • You can specify table, column name, and column type for each variable if you wish.
    • You can run functions on values before they are saved.
  • Powerful criteria for mandatory fields:
    • strings
    • regular expressions
    • code evaluation
  • Security features:
    • When users send invalid values by manipulating the HTML code on the client side, they will not be saved.
    • Manipulated page skipping or moving back where not allowed is prohibited.
  • Easily save time, browser information or whatever without a form element.
  • Hooks for calling your own PHP function within flexSURVEYs functions.
  • You name the variables. If you want you can also set the values for e. g. different radio buttons, or you can have 1, 2, 3, ... as the default.
  • No layout forced on you. You can but do not have to use the demo survey as a template.

Missing features

  • No data export. You need to get the data from the MySQL table yourself (e. g. using the phpMyAdmin software).
  • No error handling for the programmer. flexSURVEYs functions will not tell you when they are used inappropriately. (This might change in a future version.)

Cases in which you do not want to use flexSURVEY

  • If you do not want to edit PHP code, flexSURVEY is not the right thing for you.
  • The person programming the survey can run any PHP code he/she wants, including code that deletes your precious data or sends spam emails. Thus, if you e. g. want other people to create surveys for you, but do not want them to have full access to database and server, flexSURVEY is the wrong choice!


  • PHP 5.2.2 or later
  • MySQL database (Support for other DBMSs is planned.)
  • Knowledge of PHP, (X)HTML and CSS.
Page last modified on May 10, 2012, at 03:42 PM