Hi,
A comma-separated string of IDs will set multiple values into a relation field e.g. as follows
You can aggregate the insert_ids into such a string to do what you mentioned.
As an aside, I see from your code that you are using values taken directly from $_POST. That is perfectly fine but to be on a safer side, you should sanitize the value as follows -
Hope it helps.
A comma-separated string of IDs will set multiple values into a relation field e.g. as follows
- Code: Select all
response_details='31, 54, 56, 102'
You can aggregate the insert_ids into such a string to do what you mentioned.
As an aside, I see from your code that you are using values taken directly from $_POST. That is perfectly fine but to be on a safer side, you should sanitize the value as follows -
- Code: Select all
<cms:php>
global $CTX, $FUNCS;
..
$question = $FUNCS->cleanXSS( $_POST["$questionNo"] );
$answer = $FUNCS->cleanXSS( $_POST["$answerNo"] );
..
</cms:php>
Hope it helps.