Practical one...
Posted: Tue Mar 03, 2009 7:15 pm
Recently I started writing a questionnaire, and I need help with calculating values. I've managed to put item names in MySQL database and retrieve them in a table. Questionnaire consists of 200 yes/no questions, so I did something like this:
I reckon this is trivial stuff, but, hey, I'm still official beginner...
Thanx in advance!!
I hope you've got the picture... "y" values are positive responses, and "n" negative ones (surprisingly). I would like to count "y"'s for questions e.g. #1,#5,#6,#9,#15, and to add value "1" for every "y" found on those variables. Then I would like to create new variable, let's call it $var, which would have value 5 if respondent answered "yes" to all five questions.for($i = 1; $i <= 200; $i++) {
$row = mysql_fetch_array($result);
extract($row);
echo $item;
echo "<input type = 'radio' name = 'rsp$i' value = 'y'>yes";
echo "<input type = 'radio' name = 'rsp$i' value = 'n'>no";
echo "<br>";
}
I reckon this is trivial stuff, but, hey, I'm still official beginner...
Thanx in advance!!