I have a peer evaluation application I am developing at a local univeristy. At the end of the term the course director has each student do a peer evaluation on all his team mates he worked with during the term.
The course director actually grades the "value added" of the feedback each student provides to their team mates.
Example:
What is the single most valuable contribution this person makes to your team?
What is the single most important thing this person could do to more effectively help your team?
They provide a comment (feedback) to each team mate and the course director will assign a point value to what he or she thinks of how beneficial or valuable this feedback was.
Follow?
So my question is I have a form showing a student and all his feedback comments to his team mates (5 of them). The course director uses a list box to assign the point value to each feedback. I want to update a table and insert the point value for the rater per each student for each question.
My code looks like this.
echo"<table width=\"100%\" border=\"1\" cellpadding=\"3\">"
. "<tr><td colspan='3' align='left'>Student: $SName_First $SName_Last</td><tr>"
. "<tr><td align='center' width='30%'><b>Question</b></td><td align='center' width='30%'><b>Reply</b></td><td align='center' width='30%'><b>Rating</b></td></tr>"
. "<tr><td align='left' width='30%'>What is the single most valuable contribution this person makes to your team?</td>"
. "<td align='center' width='30%'>$qa_1_text</td><td align='center' width='30%'><select name='qa_1_rating[]'>"
. "<option value='0'>0</option>"
. "<option value='1'>1</option>"
. "<option value='2'>2</option>"
. "<option value='3' selected>3</option>"
. "<option value='4'>4</option>"
. "</select></td>"
. "</tr>"
. "<br />\n"
. "<tr><td align='left' width='30%'>What is the single most important thing this person could do to more effectively help your team?</td><td align='center' width='30%'>$qa_2_text</td><td align='center' width='30%'><select name='qa_2_rating[]'>"
. "<option value='0'>0</option>"
. "<option value='1'>1</option>"
. "<option value='2'>2</option>"
. "<option value='3' selected>3</option>"
. "<option value='4'>4</option>"
. "</select></td>"
."</tr>";
echo "<input type='hidden' name='uidstudent[{$UID}]'>\n";
}
echo "<input type='hidden' name='op' value='TLM2EvalGradeInsert'>\n";
echo "<input type='hidden' name='rater' value='$rater'>\n";
echo "<tr><td colspan='3' align='center'><input type='submit' value='Submit'></td></tr>\n";
echo "</form>\n";
echo "</table>\n";
I included uidstudent[{$UID}]' inside my loop so to get the UID (identifies a student ID)
I process this on another form.
foreach ($uidstudent as $UID => $value) {
if I do this to see what the _POST array looks like I get this.
Array
(
[qa_1_rating] => Array
(
[0] => 3
[1] => 3
[2] => 3
)
[qa_2_rating] => Array
(
[0] => 2
[1] => 0
[2] => 4
)
[uidstudent] => Array
(
[U00583382] =>
[U00583949] =>
[U00583822] =>
)
[op] => TLM2EvalGradeInsert
)
Array
(
[qa_1_rating] => Array
(
[0] => 3
[1] => 3
[2] => 3
)
[qa_2_rating] => Array
(
[0] => 2
[1] => 0
[2] => 4
)
[uidstudent] => Array
(
[U00583382] =>
[U00583949] =>
[U00583822] =>
)
[op] => TLM2EvalGradeInsert
)
Array
(
[qa_1_rating] => Array
(
[0] => 3
[1] => 3
[2] => 3
)
[qa_2_rating] => Array
(
[0] => 2
[1] => 0
[2] => 4
)
[uidstudent] => Array
(
[U00583382] =>
[U00583949] =>
[U00583822] =>
)
[op] => TLM2EvalGradeInsert
)
I don't think I have the UID paired correctly to the scores given to each feedback.
When I get this looking good I want to update a table.
$result = $db->sql_query("UPDATE `".$prefix."_tl_M2peereval` SET `qa_1_rating` = '$add_qa_1_rating', `qa_2_rating` = '$add_qa_2_rating' WHERE `rater` = '$rater' AND `UID` = '$UID'");
if (!$result) {echo("<p>Error performing query: " . mysql_error() . "</p>");}
any help is appreciated.