Documentation

CTestResult::AddResponse

bool
CTestResult::AddResponse(
 int TEST_RESULT_ID
 mixed RESPONSE
);

The AddResponse method saves an answer of a student and determines if the answer is correct.

Parameters

ParameterDescription
TEST_RESULT_ID The examination question ID.
RESPONSE The answer ID or an array of ID's.

Return Values

The method returns true on success, or false otherwise. If an error occurs, the exception will contain the error description.

See Also

  • CTestResult::Update
  • Example

    
    if (CModule::IncludeModule("learning"))
    {
        $TEST_TESULT_ID = 2962;
        $RESPONSE = 186; /* or Array(186,187); */
    
        $res = CTestResult::AddResponse($TEST_RESULT_ID, $RESPONSE);
        if($res)
         echo "Response has been added ";
        else
         echo "Error";
    }
    © «Bitrix24», 2001-2024
    Up