Beispiel #1
0
 * 
 * 11: Mikko Koski
 * 12: mikko.koski@tkk.fi
 * 13: Normaali ruokavalio
 * 14-0: Tykkään kahvista
 * 14-1: Tykkään suklaasta
 * 14-2: Tykkään pähkinästä
 * 15: Punaviini
 * ilmo_id: 56
 * user_id: 143
 * question_ids: 11,12,13,14-0,14-1,14-2,15
 */
$signupId = CommonTools::POST("signupid");
$userId = CommonTools::POST("userid");
$signupGadget = new SignupGadget($signupId);
$questions = $signupGadget->getAllQuestions();
$answers = array();
// This is for debugging. It's easy to see from here the variable names that
// the form sends
$debugger->listDefinedPostAndGetVars("save.php");
foreach ($questions as $question) {
    $answer = null;
    // Checkbox is a bit more complicated
    if ($question->getType() == "checkbox") {
        $answer = parseCheckboxAnswer($question);
    } else {
        $answer = parseNormalAnswer($question);
    }
    array_push($answers, $answer);
}
// All answers are now in the answers array. Let's check that user answered