<?php if (isset($_POST['submitQuestionnaire'])) { if ($user) { $_POST['userID'] = $user->id; //print_r($_POST); $qp1validator = new FormsModel($_POST); $q1return = $qp1validator->validateQuestionnaire(); } } ?> <div class="background"> <strong><h1>Pre-Study Questionnaire Part 1</h1></strong> <fieldset> <form method="post"> <div> <div id="questionnaireMessage" style="display:none"></div> <?php $questions = array("How often do you perform the Sit and Be Fit exercises?:", "How long have you participated in the Sit and Be Fit program?:", "You exercise:", "Where do you exercise:", "Do you consider the Sit and Be Fit program host Mary Ann Wilson to be your exercise partner?:"); $options = array(array("Less than once a month", "Once per month", "Once per week", "More than once per week"), array("Less than 3 months", "3 to 6 months", "6 to 12 months", "More than 12 months"), array("By yourself", "With a partner", "With a class", "Other"), array("Home", "Gym", "Other"), array("No", "Yes")); for ($i = 1; $i <= count($questions); $i++) { echo '<div><div><label>' . $questions[$i - 1] . '</label><br></div>'; for ($j = 0; $j < count($options[$i - 1]); $j++) { echo '<div class="input"><input type="radio" name="q' . $i . '" required ' . (isset($_POST["q{$i}"]) && $_POST["q{$i}"] == $j ? "checked" : "") . ' checked value=' . $j . '>' . $options[$i - 1][$j] . '</div>'; } echo '</div>'; } ?> </div>