Documentation

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 answer ID to be copied.
question_id The question ID to which the answer is to be copied.
Optional parameter. 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;
}
?>
© «Bitrix24», 2001-2024
Up