Hi,
I am working on a survey application. A user fills in different questions and submits the survey. At the moment I am working on error checking. I am doing this in PHP rather than javascript.
The way the survey is set up, it is split into different pages with a number of questions on each page. If, for example, a user is on a page with 5 questions and they only complete 4 then they will get an error message and the same 5 questions will be output. These questions are all created dynamically and are named like this:
$qid and $q1r are values from a DB. The reason each question is named like answer[$qid] is to do with the way I insert them into the database. I loop through the HTTP_POST_VARS array with a foreach looking for every element in the 'answer' array.PHP Code:echo '<input type="radio" name="answer[',$qid,']" value="',$q1r['aid'],'"';
When a user hits submit the error checking checks the number of passed values against the number of questions on the previous page. If this number is less than the number of questions then there is an error and the p[revious questions are loaded again. What I need to do is to make any of the questions that were completed, still maintain there values.
In pseudo code it is like this:
Any help with this is appreciated.PHP Code:if(radio_button_value == question_variable_value_from_prev_page){ echo selected';
}
Thanks,
Martin







Bookmarks