Bitrix Site Manager

CFormAnswer::Copy

mixed
CFormAnswer::Copy(
 int answer_id,
 mixed question_id = false
)

The method Copy is used to copy an answer. Returns the ID of the new answer on success, or false otherwise.

Parameters

Parameter Description
answer_id The ID of the answer which is to be copied.
question_id The ID of the question to which the answer is to be copied.
Optional. False by default which means current question.

See Also

Example



<? 
// The ID of the answer "yes" to the question "Are you married"?
$answer_id = 589;

// copy the answer
if ($NEW_ANSWER_ID = CFormAnswer::Copy($answer_id))
{
    echo "The answer #589 has been successfully copied to the new answer #".$NEW_ANSWER_ID
}
else
{
    // display the error description
    global $strError;
    echo $strError;
}
?>