704 GÖRITZ AND BIRNBAUM
or for small efforts like obtaining RSVPs to a party, the
method is not practical for large research projects.
The third method is to use server-side CGI (“common
gateway interface”) scripts to process and save the form
data. In this case, the action attribute of a Web form sends
the form’s data to a CGI script that is located on a Web server
(Schmidt, 1997, 2000). An example of such an attribute is
form action“http://your.domain.net/script.php”
method“post”.
Thus, use of CGI requires the researcher to have access to
a CGI-enabled directory on a Web server.
There are several benefits of using a CGI script: First,
the CGI can process the data and save them in a file for-
mat ready for analysis. Order bias can be eliminated by
presenting items and alternative answers in random order,
and the CGI can reorganize the data. Also, skip patterns
can be incorporated into questionnaires. In addition, par-
ticipants’ input can be validated in real time; for example,
data errors can be detected and respondents pointed to
omitted items (Göritz & Schumacher, 2000).
CGI scripts can be written in any language that a given
server can execute, such as ASP (“active server pages”),
Perl (“practical extraction and report language”), or PHP
(“hypertext preprocessor”). PHP is an increasingly popu-
lar scripting language (see www.php.net/usage.php). As
with Perl, PHP interpreters are open-source, free, and
available for many different platforms. One can check the
availability of PHP for one’s own platform and download a
suitable installation package from the Downloads section
of the PHP home at www.php.net.
Run Your Own Server With
Apache, PHP, and MySQL
There are many advantages to running your own server
(Birnbaum & Reips, 2005; Schmidt, Hoffman, & Mac-
Donald, 1997). You can configure the most common Web
servers to work with PHP. You can install PHP on a server
by following the installation instructions that come with
the downloaded package. In most cases, PHP is installed
on the same server where the HTML forms reside, but it
can also be installed on any other server where the data are
to be saved. Apache is a powerful, widespread, and flex-
ible open-source Web server. Apache’s Web server comes
already installed in new Macintosh computers, as are Perl
and PHP, and is freely available for PCs and almost any
other platform from www.apache.org.
There are two options for how a PHP script can store
the data from the HTML form. One simple method is to
have the script save the form data into a text file that is
located on the server. For example, this might be a comma
separated values (CSV) file. After all data have been col-
lected, the file can be read into a spreadsheet or statistical
application.
However, if participants’ input at some stage of the
research needs to be used dynamically to determine the
next question, or if the questionnaire consists of more than
one HTML form, it is advisable to have one’s PHP script
save the form data into a database. The advantage of the
database is that it can store information about the partici-
pant, make computations on those data, and dynamically
respond to the participant’s behavior. Using a database
allows the server to keep track of a participant who may
perform many tasks over a period of time.
Servers can use various database applications, includ-
ing Oracle, MS Access, and MySQL. We recommend
MySQL because it is an open-source, free, compact, fast,
reliable, robust, and multiuser database server that com-
piles on many platforms. Its home page is www.mysql
.com. MySQL databases can easily be administered with
the free tool MySQL Control Center (now succeeded by
MySQL Administrator), which can also be downloaded
from www.mysql.com.
The installation and configuration details of the PHP
interpreter, Apache, MySQL, and MySQL Control Center
are beyond the scope of this article. However, plenty of rel-
evant information can be found on the Web. For example,
there is an introductory tutorial on PHP, Apache, MySQL,
and MySQL Control Center by the first author, which can
be downloaded from www.goeritz.net/ati/. Moreover, with
precompiled binaries available, installation has nowadays
become fairly easy. Less experienced users might want
to install an automatically configuring all-in-one bundle
containing Apache, MySQL, and PHP. Searching the Web
will locate many sites from which such a bundle can be
downloaded.
To sum up, a powerful way of collecting data from
HTML forms is to have the data sent to a CGI script, which
processes the input and writes the processed data into a da-
tabase. The most cost-effective way of accomplishing this
is to use free, open-source software. We recommend the
combination of an Apache server to host your Web site,
PHP for CGI scripting, and MySQL for the database.
A Generic HTML Form Processor in PHP
A versatile PHP script called Generic HTML Form Pro-
cessor has been developed that processes any syntactically
correct input from HTML forms. It is available, along
with sample HTML forms, from www.goeritz.net/brmic.
The script creates “on the fly” a MySQL database con-
taining one data table. In the table, the script dynamically
sets up columns for all submitted HTML input fields and
saves the data in the previously created columns. Thus,
this script relieves researchers of the burdens of writing a
CGI script and building a database to store their data for
each new project. To run a survey or experiment, research-
ers merely have to complete the relatively simple task of
creating HTML forms that fit their needs. There are many
commercial and noncommercial HTML editors available
that can assist the researcher with this task. For example,
one of the two free programs surveyWiz and factorWiz
(Birnbaum, 2000) might be used. The following versions
have been written to automatically include the proper link
to the script described in this article:
psych.fullerton.edu/mbirnbaum/programs/
surveyWiz4.htm