", print_r($_POST, true), ""; // show errors ini_set('display_errors',1); /* Read in CGI Data Let's begin by reading in all the data that are relevant to our project. Note: The simplist way to do this is to read in, quite literally, EVERYTHING that we will need at ANY point during the project--whether it exists at this pass or not. */ // Data the user gives us $v01 = $_POST['v01']; $v02 = $_POST['v02']; $v03 = $_POST['v03']; $v04 = $_POST['v04']; $v05 = $_POST['v05']; $myname = $_POST['myname']; // Some data that we create and want to use and read on each pass $pass = $_POST['pass']; // Where to start? // If pass is empty, assume it is the person's first time here // and set pass to 1 to start. if(empty($pass)){ $pass = 1; } /* Here are some arrays we could, theoretically, want access to at any stage of the game. Thus, let's initialize them here and do so fresh on each pass rather than passing them forward as hidden tags. (In general, if there is no need to pass data via hidden tags, then don't do it.) */ $item_content = array("tired","hungry","anxious","sad","excited"); // The content/items to be presented $item_names = array("v01","v02","v03","v04","v05"); // The variable names that will be associated with each item $number_of_items = count($item_names); // How many items/trials are there? $max_index = $number_of_items - 1; // Let's take 1 minus the above /* If pass == 1, then that signals to us that the user should receive whatever information we want to display on the FIRST VISIT (e.g., consent information, overview of study). */ // Pass = 1 if($pass == 1){ /* In addition to presenting a greeting on the first page(pass), we are also going to decide at this moment the random order in which the stimuli/items will be presented. We will do so by - creating an array that contains an index for each item (i.e., its place in the array file drawer). - shuffling/randomizing the order of that array - using that shuffled array to index the actual items (and their NAMEs) - Finally, we preserve that random order by passing it forward as hidden data */ $item_index = range(0,$max_index); print "The original index of items is
Hello! Welcome to my website.
Please tell me your name.
"; } // End pass == 1 /* If pass>= 1 AND <= 7, then let's present the trials or items. Each time through, we increment pass by a value of 1. Thus, we end the "loop" once pass is 8 or higher. */ // We're going to skip the instructions this time, so setting $pass <= 6 instead of <= 7 if($pass >= 2 AND $pass <= 6){ print " "; } // End if($pass >= 2 OR $pass <= 6) // Pass = 8 /* We're at the end. Yay. */ if($pass == 7){ if($v01 == 1){ $message = "Hope you're feeling more lively later today! Coffee helps.
"; } print "Thanks for your time, $myname. $message
"; } // End pass == 8 ?>