Hi,
I am very new to php but I have been using it to do small web-based experiments (surveys) that have several alternative versions. I need to get an equal number of respondents for each version of the survey. So far what I've been using is a randomization variable for the indexes of the different surveys, see below. This gives me an approximate even amount, and then I manual go and remove survey versions that have enough participants until I have approx the same number of respondents for each version.
There must be a better way of doing this, I'm sure. I would just like to be able to say "Get 10 of each of these four versions" and let the thing run...but that would require keeping track of which version have been responded to. Right now each response gets saved in a file with the number of the version, so theoretically I could somehow look there to check, and perhaps have something like if X > 9, do survey Y...but I have no idea how to do this, and actually, I have no idea even what search terms I might look with to find help online somewhere.
Below is an example of what I'm now using:
<form name="info" method="post" action="<?php
$number = rand(1,4);
if($number == 1){
echo 'http://host/Task/survey.1.php'; }
elseif($number == 2){
echo 'http://host/Task/survey.2.php'; }
elseif($number == 3){
echo 'http://host/Task/survey.3.php'; }
elseif($number == 4){
echo 'http://host/Task/survey.4.php'; }
?>">
Thanks for any help, I'm really quite frustrated!
/JennyK