Buy Now
Sign in

How to print value of the input "multiple chekboxes" on the next page after submitting and loading next multipage?

wallbreaker , April 05 2017
w
wallbreaker

I have survey page that contains multipage element within containers and set printing array results to from using explode() or without it. The name of the multiple chekboxes element is "first_question". Here is the code i have placed to onsubmit event but no luck to output any from resuts though i was able to get them simply using $_REQUEST['first_question'].
How should i edit my code or forms to operate arrays "$form->data['var_name']" and not trying to intercept data.
screen

				<?php
$array = $form->data['first_qestion'];


echo'<h2>' print_r( $array)'</h2>';

?>



Regards
Maksym

GreyHead

Hi Maksym,

Please check that you have fixed the typo in 'first_qestion'

Bob

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much

w
wallbreaker

What do you mean "typo". Would you be so kind to send the screenshot or point me out other way.

Regards
Maksym

GreyHead

Hi Maksym
,

The name is first_question not first_qestion - is that the problem?

Bob

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much

w
wallbreaker

Grammar =typo. Thanks it was exactly to the point i have a lot of further question too. We are choosing the right product to use.

Rergards,
Maksym

GreyHead

Hi Maksym,

Sorry. 'typo' = typing error or wrong spelling.

Bob

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much

w
wallbreaker

Hello. Just to be clear i have checked that regular varaible on multipage just simply being cleared on next multipage form and session should be used instead.
Do you have suggestion on which action should be placed custom php to start session.

Regards,
Maksym

GreyHead

Hi Maksyn,

You can use the MultiPage action to transfer form data between pages.

Bob

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much

w
wallbreaker

Hello Bob.

I have managed to use Session to data action with multipage. The form i am trying to get printed or echoed is about to send to CRM api curl query. Thanks for the tip. Will provide you with screnshots soon.

Regards
Maksym

w
wallbreaker

The question i have directly now is how to transform $form->data['first_qestion'] to php string variable. Have tried several techniques like implode("|",$array); and no way to echo or send string data further to CURL.

Regards,
Maksym

GreyHead

Hi wallbreaker,

You can use the Handle Arrays action or you can code it in a Custom Code action as - for example:

				<?php
$form->data['first_qestion'] = implode('|', $form->data['first_qestion'] );
?>

Bob

ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much

w
wallbreaker

Managed to do it using "data_to_session" action . It is handaling input data from checkboxes of survey starting from onsubmit event keeping variables through pages. Here is the screen.
http://prntscr.com/et7l2r

				<?php
$answer1= implode(",",$form->data['first_question']);
$answer2= implode(",",$form->data['second_question']);
$answer3= implode(",",$form->data['third_question']);


$queryUrl = 'https://bitrixauthorizationhere/crm.lead.add.json';
$queryData = http_build_query($basebitrix24 = array(
'fields' => array(
"TITLE" =>$answer1,
"NAME" => $answer2,
"LAST_NAME" => $answer3,
"STATUS_ID" =>$_REQUEST['third_question'],
"OPENED" => "Y",
"UF_CRM_1491235024" =>$answer1,
"UF_CRM_1491235124" =>$answer2,
"UF_CRM_1491235376" =>$answer3,
"ASSIGNED_BY_ID" => 16,
'SOURCE_ID' => $_SERVER['REMOTE_ADDR'],
"PHONE" => array(array("VALUE" => $_REQUEST['phone'], "VALUE_TYPE" => "WORK" )),
"EMAIL" => array(array("VALUE" => $_REQUEST['email'], "VALUE_TYPE" => "WORK" )),
),
'params' => array("REGISTER_SONET_EVENT" => "Y")
));
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $queryUrl,
CURLOPT_POSTFIELDS => $queryData,
));
$result = curl_exec($curl);
curl_close($curl);
$result = json_decode($result, 1);
?>

Topic can be closed.
Thanks again, Bob.

Regards,
Maksym