Programming Economic Experiments with Php/mysql

with contributions by:
Jeroen van de Ven
Jona Linde
Roel van Veldhuizen
Joep Sonnemans
Lucas Molleman
Boris van Leeuwen

How CREED has organized the lab to run php/mysql experiments

The server computer has XAMPP installed. In the htdocs directory is a file "beginexp.html" and each experiment has its own subdirectory.
All the computers in the lab have firefox installed with the extension "kiosk". This extension makes firefox fullscreen and blocks some keys. Firefox goes to this homepage: "beginexp.html". This page looks for a cookie with the code of the table in the lab (A02, C04, etc). If the cookie is not on the computer the user is ask for the table code and a cookie is placed on that computer. This file redirects to the login page of the current experiment.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 <META Http-Equiv="Cache-Control" Content="no-cache">
 <META Http-Equiv="Pragma" Content="no-cache">
 <META Http-Equiv="Expires" Content="0"> 
<script type="text/javascript">
function getCookie(c_name)
if (document.cookie.length>0)
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    c_start=c_start + c_name.length+1; 
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
return "";
function setCookie(c_name,value,expiredays)
var exdate=new Date();
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
function checkCookie()
if (username!=null && username!="")
  username=prompt('Please enter tablenumber:',"");
  if (username!=null && username!="")
// da onderwijs nederlands 
window.location = ""+username;
 <body onLoad="checkCookie()">
  refers to present experiment...

This is a very efficient setup. When you have programmed your experiment, you make a directory in htdocs where you put your php-files and in phpmyadmin you import your database. You than only have to change the redirection line (window.location = ) in "beginexp.html" and all computers who open firefox will automatically go to your pages. In the first page of your program (login of subject) you can use $_REQUEST['table'] to get the table code of the subject.