GetDataByIDForHTML
array CFormResult::GetDataByIDForHTML( int result_id, string get_fields = "N" )
Returns an array of values for answers to the web form questions, as well as values of web form fields for the specified result. Non-static method.
Keys of the returned array precisely correspond with the rules for HTML name generation. These HTML names are generated for the web form fields.
Example of array, returned by the method:
Array ( [form_text_586] => John Harrington [form_date_587] => 10.03.1992 [form_textarea_588] => Los Angeles [form_radio_VS_MARRIED] => 589 [form_checkbox_VS_INTEREST] => Array ( [0] => 592 [1] => 593 [2] => 594 ) [form_dropdown_VS_AGE] => 597 [form_multiselect_VS_EDUCATION] => Array ( [0] => 603 [1] => 604 ) [form_text_606] => 2345 [form_image_607] => 1045 )
Method parameters
Parameter | Description |
---|---|
result_id | Result ID. |
get_fields | If set to "Y", the array returned by this method will also contain the values of web from fields; otherwise, the returned array will contain only the values of answers to the web from questions. Optional parameters. Set to "N" by default. |
See Also
- HTML field names
- [link=90365]CFormResult::Add[/link]
- [link=90379]CFormResult::Update[/link]
- CForm::Check
Examples of use
<? $RESULT_ID = 189; // result ID // get the result data $arValues = CFormResult::GetDataByIDForHTML($RESULT_ID, "Y"); // print the answer to question "Full name" echo $arValues["form_text_586"]; // "John Harrington" // print photo, uploaded as the answer to the question "Photo" CFile::ShowImage($arValues["form_image_607"], 200, 200, "border=0", "", true); // print the web form field value "Quote" echo $arValues["form_textarea_ADDITIONAL_149"]; // 134 USD. ?>
© «Bitrix24», 2001-2024